Difference between revisions of "CompactFlash boot drive"

From ThinkWiki
Jump to: navigation, search
(noatime implies nodiratime, so no need to specify both http://lwn.net/Articles/245002/)
(SanDisk Extreme)
Line 52: Line 52:
 
To set a SanDisk Extreme adapter attached to the secondary IDE interface (Ultrabay) to Fixed disk
 
To set a SanDisk Extreme adapter attached to the secondary IDE interface (Ultrabay) to Fixed disk
 
  ATCFWCHG.COM /S /F
 
  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 compute with a regular IDE (PATA) interface.}}
  
 
===Kingston Ultimate===
 
===Kingston Ultimate===

Revision as of 10:07, 29 May 2008

Addonics Dual slot CF to IDE adapter with 8GB SanDisk Extreme IV

Changing your HDD for a CF boot drive with a Compact Flash card and adapter is an alternative to an expensive SSD. This is primarily done by ThinkPad X40 series owners due to the extremely slow speeds of the 1.8" HDD. For the time being it does mean giving up on storage capacity since the faster CF cards are currently only available up to 8GB. Most ThinkPads can have have two CF cards installed to expand available capacity.

Advantages of CF

  • Faster then the extremely slow 1.8" HDD, if you get the right card
  • solid state, no risk of damage when dropped, no need to run the APS (Active Protection System) software to detect shocks and disable the HDD
  • possibly a slight increase in battery life
  • less heat being generated

Disadvantages of CF

  • Not faster then current generation 2.5" HDDs, especially for writes
  • Capacity is limited
NOTE!
A often mentioned disadvantage of flash based storage is the limited number of writes (typically 100.000). This should not however be as much of an issue with current flash based storage due to two things;
  • The 100.000 writes applies to each memory cell separately in the card, not to the card itself
  • The flash memory cards automatically distribute the writes (moves things around) so that the number of writes to each cell is kept low
With this it should take years to kill a current flash memory card with writes, so even swap should not be an issue.

What you need

  • Passive IDE to CF adapter
  • Compact Flash (CF) card with the following
    • UDMA support
    • 266X speed or better (SLC memory type). Especially Write speed is important!
    • preferably one that identifies as Fixed disk
    • 4 or 8GB capacity, depending on needs

Tested adapters

IDE to CF

ATTENTION!
the second (slave) slot on dual slot adapters does not work on the ThinkPad X41, X41 Tablet, T43, T43p and R52 due to the SATA to IDE bridge. But it will work fine on others like the ThinkPad X40 where it will function as having 2 drives attached as master and slave

These adapters will work for both ThinkPads with 1.8" and 2.5" IDE (PATA) HDDs.

  • Addonics AD44MIDECF (single slot)
  • Addonics AD44MIDE2CF (dual slot)

SATA to CF

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

TODO
If someone has tested any, please add them here

Removable vs Fixed disk type

Most newer compact flash cards identify themselves as Removable instead of Fixed disk. For Linux this does not cause any problems, but Windows has issues with it and will refuse to partition such a drive, and even if you manage to get it installed it will not be able to suspend. In addition some software will refuse to install on a removable drive.

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.

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 compute with a regular IDE (PATA) interface.

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.

SATA to IDE bridge

On ThinkPad models with a SATA to IDE bridge (ThinkPad X41, X41 Tablet, T43, T43p and R52) there are some additional limitations and annoyances when changing your HDD to a CF card.

You can only have one CF card, even if you have a dual slot adapter. The second card will not be seen, this is a limitation of the bridge chip and the way SATA functions.

Beeps and error on boot. The ThinkPad BIOS 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 will not sound if you muted sound before a shutdown/reboot with the hardware mute button, but you will still get the error.

Storage capacity issues

Due to the fast CF cards that you will want for your OS drive only being available in smaller sizes (up to 8GB currently) you might not have enough local storage for your needs. Here are some suggestions on how to work around it.

  • Add a second CF card, using the dual-port adapter. This will show up as an additional drive on ThinkPads that support it, and you might even use a larger capacity (and hence slower card) for this purpose depending on your needs.
  • use another flash memory card in the dedicated slot on select ThinkPads (CF on ThinkPad X20 and X30 series and SD on ThinkPad X40 and X60 series). Note that this slot might not be very fast.
  • use a USB drive or memory stick for additional storage. This is ugly since it will stick out, and should be avoided on ThinkPads that do not support USB 2.0
  • use NAS (network attached storage)

4GB is sufficient to install Linux or Windows with some basic applications. So unless you intend to keep your library of music/videos/pictures local the 8GB card might be sufficient.

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 [1] 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

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