Russell's Blog

New. Improved. Stays crunchy in milk.

Converting an IBM X40 to Flash

Posted by Russell on February 21, 2008 at 7:02 p.m.
The Hitachi 1.8" hard drive in the IBM X40 is probably the worst data storage product I've ever used. It is expensive, excruciatingly slow, irritatingly loud, and non-standard. There are basically no options for replacement except to just buy another one. And, as I discovered to my sorrow, it is also fragile and unreliable. So, I decided to replace it with a Compact Flash card.

You may have heard something about Solid State Drives (SSDs), such as the one available as an option for Apple's MacBook Air. You can think of this project as sort of a poor-man's version of these products.

While most CF drives are relatively small and expensive, there are a few products that seem to sacrifice speed for capacity. This may seem sub-optimal, but the drive it will be replacing is astonishingly slow to begin with. According to hdparm, it can do buffered reads at 18 MB/sec, but in practice that seems pretty optimistic.

If I understand correctly, the Compact Flash interconnect standard is basically a subset of IDE. So, you just need a little passive adapter board, and you can plug a CF card directly into an IDE port. I used a D44MIDECF adapter card from Addonics. At $20, it's a little overpriced. There are no active components, and the board contains only the CF plug, the 44 pin IDE pinout, a jumper, a surface mount resistor, a surface mount capacitor, and a surface mount LED. On the other hand, it is something of a specialty part, so I suppose I should be happy that they bothered to sell it to me at all. For the CF card, I found this monster on NewEgg.

The X40 doesn't have removable media (other than the SD/MMC reader). I've always hated fiddling around with boot floppies and installers anyway. Supposedly, Debian has gotten their installer in better shape since I last played with it. That was more than five years ago. I just skipped that whole process, and built out a minimal Debian install by hand. I popped the CF disk into my SanDisk USB Flash reader, and did the following :

sudo fdisk /dev/sdc 
   # created a 31 GB primary partition tagged as Linux [id 83]
   # and a 1 GB primary partition tagged as Linux Swap [id 82]
sudo mkfs.ext3 /dev/sdc1
sudo mkswap /dev/sdc2
sudo mount /dev/sdc1 /mnt/flash
sudo debootstrap sid /mnt/flash/ http://linux.csua.berkeley.edu/debian
sudo chroot /mnt/flash
vi /etc/apt/sources.list
apt-get update
apt-get dist-upgrade
apt-get install linux-image-2.6.24-1-686 grub sudo 
mkdir /boot/grub
update-grub
vim /boot/grub/menu.lst
exit
sudo grub-install --root-directory=/mnt/flash --recheck /dev/sdc
Then, pop the CF card in its little adapter board into the drive bay, and boot. Hooray! Here is how hdparm identifies the CF disk :
/dev/hda:

 Model=, FwRev=20070912, SerialNo=CF CARD 000040D9
 Config={ HardSect NotMFM Fixed DTR>10Mbs }
 RawCHS=16383/15/63, TrkSize=0, SectSize=576, ECCbytes=4
 BuffType=DualPort, BuffSize=1kB, MaxMultSect=1, MultSect=off
 CurCHS=16383/15/63, CurSects=15481935, LBA=yes, LBAsects=63438848
 IORDY=no, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio1 pio2 pio3 pio4 
 DMA modes:  mdma0 mdma1 *mdma2 
 AdvancedPM=no

 * signifies the current active mode
The default IDE settings for the CF drive result in very slow performance, so some tuning is in order. I edited /etc/hdparm.conf accordingly :
/dev/hda {
        write_cache = on
        io32_support = 3
        dma = on
        lookahead = on
        interrupt_unmask = on
}
Here is the output of the script :
Setting parameters of disc:
/dev/hda:
 setting 32-bit IO_support flag to 3
 setting unmaskirq to 1 (on)
 setting using_dma to 1 (on)
 setting drive read-lookahead to 1 (on)
 setting drive write-caching to 1 (on)
 IO_support    =  3 (32-bit w/sync)
 unmaskirq     =  1 (on)
 using_dma     =  1 (on)
 look-ahead    = not supported
 write-caching = not supported
  /dev/hda.
The result is actually a little faster than the Hitachi hard drive :
sudo hdparm -Tt /dev/hda

/dev/hda:
 Timing cached reads:   1474 MB in  2.00 seconds = 737.30 MB/sec
 Timing buffered disk reads:   44 MB in  3.13 seconds =  14.06 MB/sec
So far, I'm pretty happy.
Frames on February 23, 2008 at 6:09 p.m.

Good to know that at least the X40 does not force you to use proprietory IBM 1.8'' drives with the stupid error 2010. I ALMOST bought a X41 two days ago.

BTW, Aren't you afraid of tearing up that CF card by using ext3's journaling, swapping, the normal logging writes, and not using noatime on /etc/fstab and ? A regular CF should only take about 10.000 write cycles. A current SSD will take 1 million.

Russell on February 23, 2008 at 9:36 p.m.

I use a similar type of CF card for the boot volumes in my Soekris boxes. They've each been running for about three years without complaint, and I didn't bother to take any special measures to reduce wear-and-tear on the Flash chips.


Out of curiocity, I've actually deliberately tried to wear out the smaller CF card that serves as the boot disk for my router / Asterisk host. It's been getting hammered on for 18 months now, and I haven't seen any evidence of damage.


I think that the write-cycle burn out for Flash must be a bit of an urban ledgend, or at least exaggerated. Maybe newer Flash chips are just more durable, or something. In any event, my experience is that CF cards last at least as long as hard drives under similar loads. My two CF cards obviously don't constitute a statistically significant sample, so maybe I just got lucky.

Frames on February 24, 2008 at 10:14 a.m.

That's good to know! I might try that, too in the near future.

BTW, I take it you got rid of that annoying noise by using the CF card. But can I ask if you have noticed less heat is produced now? Any significant improvements regarding battery live?

Thanks!

Russell on February 24, 2008 at 4:31 p.m.

The heat reduction is pretty significant. I noitce that the fan almost never switches on now. I think the CPU and the drive bay share the same heat spreader in the X40.


There are two possible reasons for the decreased fan operation. It could be credited to less heat production, or it could be because now that the drive bay is mostly empty, it is effectively an extra radiation/convection surface for dissipating the CPU's heat.


I have definitely noticed an increase in battery life -- maybe as much as 30%. I don't have measurements for it yet. This is a very well-used laptop, so obviously the battery is not in great condition.

Frames on February 24, 2008 at 5:39 p.m.

Thanks for taking the time to respond.


Seems like you have just revamped your notebook at a decent price. And sorted out a couple of issues at the same time.

All the best.

Russell on February 24, 2008 at 6:10 p.m.

No trouble!


I remember just enough Spanish to sort of follow your blog -- it's been almost ten years since I've used it! Do you have an Eee PC yourself?

hitachi battry on May 01, 2008 at 2:24 a.m.

I tested this camera for a client. I didn’t have the light running for more than 15 minutes. The battery lasted approximately 6 hours before recharging. The LCD, however, had a few dead pixels - never saw this before. Tried returning for exchange and had to put up quite a fight. Anyone else seen this? http://www.batteryfast.co.uk

ibm battery on May 16, 2008 at 2:21 a.m.

I tested this camera for a client. I didn’t have the light running for more than 15 minutes. The battery lasted approximately 6 hours before recharging. The LCD, however, had a few dead pixels - never saw this before. Tried returning for exchange and had to put up quite a fight. Anyone else seen this? http://www.batterylaptoppower.com

Jamie Kitson on June 04, 2008 at 12:44 p.m.

Aren't most CF cards actually hard drives, not solid state flash? And I don't think hdparam is a very reliable speed test, try bonnie++

Jamie

atreyu on July 04, 2008 at 9:02 a.m.

Remember 100000 Flash Cycles and you CF is history.

Regards

Jeff on July 05, 2008 at 6:44 a.m.

That's cool! Nothing I'm in any rush to do on my laptop (it's my most powerful/fastest machine right now and serves as a test bed), but tempting for my tower! Thanks to NFS, it's not like I'd need any more space.

Also, @Frames:
A few years back, IBM sold its hard disk drive division to Hitachi. So the 1.8" Hitachi drive in Russel's X40 is probably identical to the 1.8" IBM drive in the X41 you were looking at.

James on July 17, 2008 at 9:33 p.m.

err jamie no a cf card is solid state are you thinking of the microdrive? thats a hard disk

Gene on August 19, 2008 at 8:25 p.m.

The link you gave to the Addonics D44MIDECF adapter card now points to a 2.5" device. The name is still the same -- but is this the same device as you used? Or did they dump the 1.8" version?

anthony on August 19, 2008 at 9:40 p.m.

re Gene above, I am also unsure regarding 1.8" or 2.5". Will the the 2.5" adapter fit into the X40 or should I be looking for a 1.8" adapter?

jh on September 18, 2008 at 7:34 p.m.

thanks! i got the 32gb CF and will put it in my CF card adaptor in the PCMCIA port. the external hard drive is too annoying to bring around and i need more space. found this site when googling how to replace hard drive, but will add on with the CF card instead.

Hans on September 19, 2008 at 11:02 a.m.

Ebay offers the adapter for USD 1,99.
Search for:
CF as 44-pin 1.8" IDE Lenovo IBM X40 X41 HDD Adapter.
Any experience with Windows XP ?

laptop battery on October 14, 2008 at 3:22 a.m.

it really irritating when in between typing on a important mail suddenly the laptop battery starts beeping indicating low battery and unfortunately u dont have a power cord
Now has not been able to determine that this is really, but hoped that can have this technology. Our battery can use for a long time
We warrant that the products sold in our website, other than explicitly stated, are 100% brand new and free from defects in material and workmanship.

Ignore this field:
 optional; will not be displayed
Don't put anything in this field:
 optional
Don't put anything here:
Leave this empty:
URLs auto-link and some tags are allowed: <a><b><i><p>.