CompactFlash boot drive

From ThinkWiki
Revision as of 01:17, 5 January 2010 by Grmela (Talk | contribs) (removed "smal CF capacity" information)
Jump to: navigation, search
Addonics Dual CF-IDE HDD Adapter with 8GB SanDisk Extreme IV CompactFlash

Changing your HDD for a CF boot drive (CompactFlash card on CF-PATA/SATA adapter) is an alternative to using SSD to boost the performance.

This is primarily done by ThinkPad X40, X41 and X41 Tablet series owners due to the extremely slow speed of 1.8" HDD.

Previously, using Compact Flash cards meant giving up on storage capacity. Nowadays the biggest available CF sizes are up to 100 GB so you even gain more storage space compared to a classic 1.8" HDD.

ThinkPads utilizing PATA controller for the HDD slot can recognize both CF cards installed on a dual adapter. While newer ThinkPads, such as X41, which utilize SATA controller, can only recognize the single card installed on the primary slot.

Advantages of CF boot drive

  • Much faster access time (<1ms for CF, >20ms for 4200RPM HDD and >15ms for 5400RPM HDD)
  • Higher read throughput for >8KB blocks (may differ depending on brand, model, partition type and cluster size)
  • Higher write throughput for >64KB blocks (may differ depending on brand, model, partition type and cluster size)
  • Minimal risk of mechanical damage due to shock and vibration. Active Protection System is therefore unnecessary)
  • Does not generate any noise or vibrations
  • (Possibly) a slight increase in battery life
  • (Possibly) less heat being generated

Disadvantages of CF boot drive

  • Lower read throughput for <8KB blocks (may differ depending on brand, model, partition type and cluster size)
  • Lower write throughput for <64KB blocks (may differ depending on brand, model, partition type and cluster size)
  • Lower capacity
  • Higher price per GB
  • Not officially supported
  • Invoke boot error 2010 on certain ThinkPads, including the X41 series
NOTE!
A often mentioned disadvantage of flash-based storage is the limited number of write cycles (typically 100,000 for the current generation Single-Level Cell (SLC) NAND, the type usually used in the faster CF cards). This should not however be as much of an issue because...
  • The 100,000 write cycles applies to each address block separately in the card, not to the card as a whole
  • The flash controller automatically distribute write operations evenly (wear leveling), so that the number of writes to each address block is kept low

Therefore, it should take years of typical real world usage to render a current flash memory card based on SLC NAND unusable

However, manufacturers have started in 2008 using Multi-Level Cell (MLC) NAND to make SSD. MLC NAND typically has only about 10,000 write cycles. To complicate things further a company called EasyCo claims her Managed Flash Technology (MFT) "increases the write-life of Flash Disks more than 50-fold", which could be what made possible the launch of SSD based on MLC NAND.

If in doubt, check with the manufacturer directly for details.

See [1] and [2] for more information.

What you need

  • A passive CF to PATA/SATA adapter
    • Sadly, the X30's native CF slot does not appear to be bootable, so you're stuck using an adapter in the PATA drive sled like everyone else.
  • One or more CompactFlash cards with the following parameters:
    • (For Windows) Identify itself as a fixed disk instead of removable media
    • (Preferably) UDMA support
    • (Preferably) 266X speed or better

CF to PATA/SATA adapter

CF to PATA (IDE)

These adapters will work with both ThinkPads with 1.8" and 2.5" HDD slot with PATA interface

  • Addonics AD44MIDECF (single slot) [3]
  • Addonics AD44MIDE2CF (dual slot) [4]
ATTENTION!
Many of the adapters sold in eBay may not be usable for x40 as their #1 pin is on the left side (looking from the top, usually marked by a white diagonal line). The #1 pin should be on the right side as the Addonics series. Flipping the insertion of popular "V B1" adapter works but there is no guarantee of performance and space may not permit. On the other hand PA-CF18H adapter has been reported to work fine and may be a good alternative for Addonics converters. Please read page 15 of the forum discussion link below this page.
ATTENTION!
The second (slave) slots on dual slot adapters do not work on newer ThinkPads, including the X41, X41 Tablet, T43, T43p and R52. Because their IDE interface is actually connected to the SATA controller via an IDE-SATA bridge. The second slot works fine on the others, like the X40, which use a native PATA controller, and 2 separated drives will be recognized.
ATTENTION!
On the X41, X41 Tablet, T43, T43p and R52, the system will complain that an unsupported disk is installed (Error 2010), but will continue to boot after 5-10 seconds or after pressing enter (assuming you have a recent BIOS installed). The beeps can be muted by using the hardwrae mute button before the last shutdown/reboot

CF to SATA

These adapters are needed for newer ThinkPads with native SATA interface.

TODO
If someone has tested any, please add them here

CompactFlash cards

Speed

While many CF cards claim to have high throughput, it's not necessarily a good indicator. As the claimed throughput is usually only attainable in specific situations (usually sequential and large block operations). But in typical usage as a boot drive, it usually involves lots of random and small block operations.

Therefore, the actual performance figures can only be found out via real world benchmarks.

Below is a list of some of the cards reported to be working, it's by no mean authoritative and final.

ATTENTION!

Most CompactFlash cards by default identify themselves as removable media instead of fixed disk. Which is fine for Linux, but not for Windows.

If you have to use a CF card that has the type bits set to Removable and want to install Windows XP you can work around it as follows;

  • Use Linux to partition the drive with a FAT32 partition (you can boot from one of the LiveCD/LiveUSB distributions for this), and set the partition bootable.
  • Start the install of Windows, during install you will be given the opportunity to migrate to NTFS
  • After the install is finished you will need to install the Hitachi microdrive disk drivers (google for XPfildrvr1224.zip), which will mask the removable bits and should allow suspend and other operations that fail on a removable drive to work.

Transcend 133X/266X/300X

These cards are known to identify themselves as fixed disk via CF-IDE adapters without any manual intervention, and is of good value, and speed (for 266X/300X).

SanDisk Extreme

SanDisk used to provide a utility (when asked) under NDA to change the type bit to Fixed disk. It has however changed it stance on this and now refuses to provide it. This utility (ATCFWCHG.COM) however can be found for download at various places (try Google).

You will need to boot DOS and run it with the CF configured as either the master on the primary IDE interface or the master on the secondary interface. It will not work if the drive is attached as a slave or to any other interfaces.

To set a SanDisk Extreme adapter attached to the primary IDE interface to Fixed disk

ATCFWCHG.COM /P /F

To set a SanDisk Extreme adapter attached to the secondary IDE interface (Ultrabay) to Fixed disk

ATCFWCHG.COM /S /F
NOTE!
It seems that the ATCFWCHG.EXE utility is incompatible with SATA to IDE bridges, such as found in the X41. In those cases you will have to connect the CF card to another computer or ThinkPad with a regular IDE (PATA) interface to change the flag, after which you can put it into the ThinkPad X41.

Kingston Ultimate

The Kingston Ultimate CF card ships as CF-Removable, and although Kingston admits it is possible to change the type to Fixed disk, it was not willing when asked to provide a tool/application for this purpose.

But supposedly the Kingston card automatically changes ID based on the adapter used, so it will ID as fixed disk when used with an IDE-CF or SATA-CF adapter, but will ID as CF-Removable when used with a PCMCIA adapter.

Silicon Power 300X

to be updated

Photofast 533X

Works fine, read performance up to 43mbit/s acording to hdparm

Storage capacity issues

Due to the limited capacity for high speed CF cards, the space may not be enough for some users. As a typical OS may already consume 3-4GB already. Here are some suggestions on how to work around it. Each of the below suggestion has its pros and cons, and should be selected on a case-to-case basis.

  • Put only the OS and frequently accessed files on the main CF card
  • (If dual-CF is possible) Add a second CF card, which will show up as an additional drive. Moreover since the speed needs not be as fast as the main CF card, a slower card with larger capacity could be desirable.
  • On certain ThinkPads, there is an internal card reader (e.g. CF on X20/X30, and SD/SDHC on X40/X41/X60/X61) which can house another flash card. However, the speed is certainly to be worse than connecting to the PATA/SATA interface.
  • Use a PC Card/ExpressCard SSD drive. However, the price of SSD is likely to be more expensive than flash cards.
  • Use a PC Card/ExpressCard flash reader to house another flash card.
  • Use a USB drive. Take mind that the drive will stick out, which is less desirable as a permanent solution (appearance/damage/speed especially if USB 2.0 is not supported)
  • (If network access is readily available) Store the files on a network drive (e.g. server disk/NAS)

Linux issues

With the Addonics adapters listed above (and possibly with other ones as well), the kernel's libata driver might warn about a 40-wire cable and default to UDMA/33 operation:

[ 27.831146] ata1.00: limited to UDMA/33 due to 40-wire cable
[ 27.846808] ata1.00: configured for UDMA/33

This has been observed with version 2.6.24 of the kernel, and it may affect older ones, too. A patch is available from [5] that adds a force_cbl kernel parameter. After applying the patch and recompiling the kernel, you can then set force_cbl=80:

[    7.140864] ata1: forcing 80c
[    7.140886] ata1.00: CFA: LEXAR ATA FLASH CARD, 20071016, max UDMA/100
[    7.140890] ata1.00: 7831152 sectors, multi 0: LBA 
[    7.140908] ata1.00: forcing 80c
[    7.141625] ata1.00: configured for UDMA/100

With the patch enabled, the above system achieves 42MB/sec read performance according to hdparm. Without it, performance suffers: 23MB/sec.

Linux tuning

  • edit /etc/fstab and add the option noatime to disable writing of last access timestamps on each file or directory access for each ext3 filesystem
LABEL=/ / ext3 defaults,noatime 1 1
  • disable swap (remove swap volume from /etc/fstab), just make sure you have enough memory installed (which since memory is cheap, should be easy to just max out the machine!)
  • increase writeback time (add the following line to /etc/rc.local)
echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
  • remove beagle (if installed) from your system, it indexes the filesystem, but causes disk activity and keeps your cpu busy
rpm -e beagle beagle-gnome beagle-evolution

Windows tuning

      • Instead of throwing together all kind of tweaks here, it's probably better to keep the tweaks be CF boot-specific... And link to another page showing the more generic tweaks... ***

Due to the space constraints of CF, you will want to do some tuning of Windows. In addition there are some tunes that help performance, and can even help in the case where your not changing your HDD to CF.

  • Do a minimal Windows XP install (not a recovery) with nLite, this allows you to remove components of Windows before they even get to the HDD, such as Movie Maker, Windows Messenger and Outlook Express that you might not need, while at the same time slipstreaming the latest ServicePack (SP3 for XP). Alternatively if you cannot reinstall, you can try the public domain xplite program, but for it to be useful you need to pay, and it does not work with SP3.
  • Disable NTFS from updating the last access of a file or directory on each access. This causes NTFS to do a write for each file read operation and writes are always slower, and with flash storage might not be a good idea, for this you need to set NtfsDisableLastAccessUpdate in your registry.
  • Disable Indexing of the drive (drive properties)
  • Compress the drive (NTFS only), this saves space and might in some cases even be faster as it will require less disk access (drive properties)
  • Disable swap (system properties), just make sure you have enough memory (just max out the machine, RAM is cheap these days)
  • Disable windows system restore (system properties), if you feel you can live without it. It reserves a defined amount of space for this purpose
  • Do not enable Hibernation, it requires a huge hibernation file and suspend should be good enough.
  • Disable programs from starting on boot that you do not need (do you really need Java, Adobe, Apple iTunes, etc from starting on boot each time?) with a program such as MSCONFIG (->Start ->Run -> msconfig)
  • Disable Windows services that you do not need from starting on boot
  • Only install the IBM/Lenovo applications you truly know you will need (in my case, only the Hotkey utility and the Wireless drivers package to be able to disable wireless with Fn-F5)
  • Never do a full install of an application, do a custom install and prune the options to remove all the stuff you will never use
  • Disable HW devices in device manager that you do not need (in my case, the Modem and Infrared)
  • Only install drivers you actually need (video, ethernet, wireless and sound in my case), and remove the C:\DRIVERS directory after your done.
  • Do not run defrag, it is pointless on flash media and just causes unnecessary writes!

With this I was able to Install Windows XP (SP3) with Office 2003 (SP2), IE7, WMP 11, Symantec Client Security, Adobe acrobat reader, Firefox, Thunderbird, Pidgin and Palm Desktop in addition to the necessary drivers in under 4GB of an 8GB CF card on a ThinkPad X40.

useful links