Using Compact Flash cards as SSD alternative

by Daniel Böhmer

Abstract: This article explains some basics on IDE and Compact Flash and I report my experiences with using CF cards as harddisk replacement in my IBM ThinkPad X40. All of this works great and I give recommondations which devices to buy etc.

Last changes:

Content

  1. Introduction
  2. Compact Flash and IDE
  3. My target system: ThinkPad X40
  4. Some words on CF to IDE-44 adapters
  5. Two CF cards and RAID-0
  6. CF cards I used
  7. Assembly
  8. Software issues
  9. Summary
  10. Links

Introduction

Solid State Disks (SSDs) are a big deal these days and everybody wants to get one. Advantages are obvious:

Propably the worst drawback at the time of writing is the high price of good SSDs. Additionally it is difficult to find one for the old IDE port. But to my surprise I found a cheap alternative to get the main advantages of SSDs another way: using Compact Flash drives.

Compact Flash and IDE

Of course you need some CF card reader device in order to use them as harddisk replacement. I assume ordinary CF to IDE adapters with floppy power connector will be sufficient (I have not tested!). But USB card readers might be inappropriate because of the low speed and additionally overhead by the talkative USB stack.

As you should know Compact Flash's IO interface looks pretty the same like IDE. In fact it is pin compatible and you can replace IDE devices by CF cards without the driver noticing. Well, there is one problem: CF devices export a bit identifying them as either fixed disk (HDD mode) or removable device (like in USB card readers). Microsoft Windows cannot install to removable devices (but boot from them without problems—no comment) and thus refuses to work with CF cards with the removable bit. In the reality this is no problem at all because 1) I use Linux and other free OSes and recommend you to do the same and 2) you can expect all modern CF cards to identify themselves depending on the port they are connected to. For example a CF card in a PCMCIA adapter reports removable device and the same card identifies as fixed disk when connected to IDE. GNU/Linux doesn't really care about all of that and just lets you install on any device it supports to read/write (generalization).

In short: to use CF cards as boot device you need only a CF to IDE adapter.

A word on SATA: I am fully aware of SATA being state of the art today. Unfortunately SATA is not even similar to IDE and broke compatibility with CF. It was a good decision to eliminate all the cruft coming from the 1980s: SATA doesn't know master/slave stories, jumper settings, single devices occupying the bus etc. Thus you need an intelligent™ adapter—more technically an electronic device—shoveling data from SATA link to the CF and vice-versa. I didn't test this but I read that you can have problems connecting more than one CF to these ports.

The target system: ThinkPad X40

My target device is my subnotebook IBM ThinkPad X40 (indeed still an original IBM product) which comes with an 1.8″ harddisk by default. This one is rotating at 4200RPM and mine was 40GB of size. The drive provides acceptable speed but I did mostly suffer from the high power drain and also feared destroying the device by handling my ThinkPad too rudely.

Hitachi 40GB harddisk
The original 40GB harddisk from Hitachi

The harddisk resides in front of the keyboard on the left side of the ThinkPad. Being designed for a 1.8″ disk it offers few space and you cannot use any type of adapter here.

IBM ThinkPad X40
My IBM ThinkPad X40

Luckily the X40 still came with a true IDE port which can take control over up to two CF cards. The successor model X41 was based on a newer chipset featuring SATA. IBM engineers stuck to IDE harddisks and thus integrated a SATA to CF adapter in the mainboard. Unfortunately this can only access one single CF card. In addition with other problems with the X41 like using third party WLAN devices I prefer an X40 over X41.

I had some problems accessing both CF cards at the IDE port. When using the 8GB CF card as IDE master I could only access one of them. The workaround is to insert the 32GB card as master and the smaller card as slave. I have no idea what the reason is. If you have problems with the detection of the cards just try switching them.

Some words on different CF to IDE-44 adapters

For usage in notebooks you need an adapter from IDE-44 to CF. This is an important difference to other ones: IDE with 44 pins has lines for power and no extra power connector is needed. This standard is used in all notebooks with IDE.

All CF adapters
All adapters I used at a glance

There a few different models out there but they differ widely in price and usability. This was a big surprise to me because none of them needs any electronic parts to function.

They are listed in the same order I bought them. Thus I have tested all of them.

Asian low-end product: dual CF slot

First I bought a cheap adapter from eBay. It is told to host two CF cards and work like the Addonics thing. I never found out about the manufacturer. However it is labeled with

CF-IDE44/2.0mm ADAPTER V.HO
DMA/Panel LED/4 assemble holes

and offers a jumper for swapping master and slave. It might be necessary to shorten the jumper pins with a wire cutter or something alike in order to make the adapter fit into the HDD space.

Dual CF adapter
Asian dual side CF adapter

Unfortunately Asian engineers made some big mistake: Obviously they never read IDE specs and checked how to position the IDE pins. On electric level all pins work well but the construction is unusable just because the CF pins are on the wrong side respectively turned upside down. Imagine you pull out your ordinary IDE drive, flip it by 180° and try to push it in again. The pins will still fit into the grid of 2×22 holes but the drives case will extend the space offered. FAIL.

One day I found a photo in some Internet forums showing some of these adaptors bent in a way that it might work. I cannot find it again but made a local copy of it. I have no information about whether this worked out. If you know where this was posted, please send me the link. I cannot find it again the depths of the web.

Nevertheless in my opinion buying this make for usage in an IBM ThinkPad is a waste of time and money. Be aware that you cannot use the 2nd CF slot in an X41 anyway. If you have already purchased one of these: I found a picture of an adapter bent to fit into the X40. I don't know if that one worked. Try on your own risk. For other systems this adapter might work well out of the box.

Asian low-end product: single-side

I decided to purchase the single-sided variation of this thing because it is the cheapest on available. With that I could boot from CF the first time. It is pretty much the same like the dual-sided one including the label.

Single CF adapter
Asian single side CF adapter

This adapter is to be recommended when using only one CF.

Addonics adapter

This one is most often refered by any article on this topic. It is much more expensive and at the time of writing difficult to find on eBay etc.

Addonics dual CF adapter
Dual side CF adapter from Addonics

Ordering from the manufacturers page is even more pricy. Just take your time and have an eye on your favorite auction platform. Some day an Addonics item will show up and that's your chance to get CF-SSD the luxury way;-)

Fortunately this one works without any problems in your ThinkPad.

Two CF cards and RAID-0

When coming to RAID-0 many people get instantly panicing about data security and stuff. Forget all of that. Well, just for flash memory of course:-)

In fact using RAID-0 for two disks doubles the risk of failure and for traditional harddisks all data is lost when one drive dies. This is still true for flash memory but consider the following: The endurance of flash devices is much better than harddisks with moving parts. It is generally pretty rare for a flash drive to fail. Without mechanics as factor of high risk a failure of the controller and single flash cells is equally probable. What does that mean? The probability of a chip to fail is much smaller than that of a harddisk. Additionally for flash it is possible that single memory cells die. The controller can detect and handle this and thus most of your data is still available. Indeed the CF card will be still usable and you probably never notice. After all a CF card completely failing is a pretty rare event.

With this in mind I decided to take the risk of running software RAID-0 because data security would still be far better than before.

After all that headache about the topic I was pretty frustrated when doing some measurements with two CF cards. Reading from CF on IDE master and slave does not save time!

Obviously the CF card blocks the whole IDE channel until data is read. In addition with the overhead of doing the RAID management overhead I got pretty bad results. Reading from RAID-0 is even slower than from the single cards!

The conclusion is to save the hassle with setting up RAID. Instead purchase one big and one fast CF card if possible. This will enable you to put important system files on the fast one and export all your data to the big one. My configuration is a 32GB Kingston Elite Pro 133x for data and a 8GB SanDisk Extreme III for the OS. By chance this is equally the size of my old harddisk of 40GB. Not much space but everything I need on the way.

CF cards I used

Big CF cards are quite expensive and I played around with some small ones before purchasing a 32GB card. With the card being >90% full I had heavy problems with the system hanging and ended up planning to buy a SanDisk Extreme III.

Transcend 133x 2GB

This one is too small to host my OS or data files. I have just used it to test the CF adapters. It seems to work well and offer reasonable speed. I did never test it any further.

Transcend 2GB CF card
CF card from Transcend with 2GB

Kingston Elite Pro 32GB 133x

This one is the cheapest CF with high capacity available. Doing the first boot from this one was quite impressing: Although the specified speed of 133x is quite low booting was noticeable faster than from the old hardisk.

Kingston 32GB CF card
Huge CF card from Kingston with 32GB

When using the CF for a longer time I experienced problems with writing. Writing is nearly as fast as reading for some MBs but then speed drops dramatically. I suppose this is connected to the write cache of the OS but never examined this in detail. However when some application is writing to the CF and the write cache is full the whole system blocks for a while. No application which needs to either read or write to/from the CF will work for some seconds. As you can imagine this is pretty annoying. Example: When using Firefox with some tabs open (not as many as memory swapping was necessary) scrolling and tab switching comes to halt from time to time because Firefox needs to read or write. This brought me to planning to buy the SanDisk Extreme III.

Nevertheless I can report that general read speeds are faster than specified by 133x.

SanDisk Extreme III

This card is quite more expensive than the Kingston one. Luckily I got it as a present!

SanDisk 8GB CF card
Fast CF card from SanDisk with 8GB

Both read and write speeds are much faster but the card blocks like the Kingston when doing much write operations. With the speed improvement it seems to be good idea to use this one for the OS files. If you have the extra money you can buy even better cards and will soon reach speeds comparable to ordinary harddisks.

Booting your notebook is of course much faster because random reads have few seek time.

Assembly

Install set
All parts to be assembled together

With all the testing the multiple changes of adapter/CF cards I got some exercise with assembling and disassembling the CF adapter with memory cards. So I recommend having bright light from the top and pushing the adapter into the case at first. Afterwards the cards can be inserted.

I didn't use the HDD caddy which came with the original disk because it cannot be mounted to the CF adapter and is generally of no use.

Use some portion of foam, e.g. from a recent electronics packaging, to have some cushioning and prevent the parts from clackering.

CF cards built in
Two CF cards built into the ThinkPad (cover removed)

Software Issues (hints only applicable to Linux)

The selection of the right hardware is not the only issue with usig CF cards as harddisk replacement. Because most system software is still optimized for being used with traditional harddisk it doesn't work optimal.

In contrary to most SSD as nowadays CF cards commonly do not support the TRIM command which allows the operating system to tell the card when blocks on the disk get free. The internal storage software of the CF card can now reuse those blocks for new data. To my knowledge there is no solution for that.

To reduce the time the computer is blocked while waiting for the write buffer to be written to the CF card I recommend the mount option sync. That disables the operating system's cache for write operations and makes it execute them in sync. This is an example line for the fstab file:

/dev/sda1   /       ext4   sync,noatime      0   0
/dev/sda2   /home   ext4   sync,nodiratime   0   0

This way the system is quickly blocking for any write operations but due to the buffer being very small there is only a short period of time needed to complete the write operations. The writes won't get any faster by that but the perceived system speed is better!

After all the system strategy to write everything instantly or everything after a cache timeout, but still all data at once is really poor. I would really like to see another strategy implemented which utilizes a buffer but instantly starts writing it down without blocking. Only after the buffer got too huge or data is too old it should block. The old buffer strategy focuses on minimizing the time the harddisk is acting which leads to lower energy consumption and thus longer battery time. But I do personally consider fluent usage without blocking GUIs more important than an insignificant amount of battery time.

Additionally I recommend using the mount options noatime or nodiratime which indicate no access time updates [for directories]. That avoids many write operations by the operating system only for accessing files. I used the disable access times to the system partitions and disable only directory access times for the /home partition as shown in the example. Be aware that some programs or workflows which rely on the access times being valid will not work anymore—use it only if you know what it does.

Summary

Links