HomePage RecentChanges

LinuxOnCompactFlash

My attempts to wade through the various bits of information, bad and good, available on the net.

Important Update!!

UPDATE

Okay guys, I have an interesting new data-point for this CompactFlash?-SSD scheme. It goes a little like this: don't bother.

I've been in China for about four weeks now, and I think I've been using this setup for maybe 2 months. And the other day, sumomo started to run out of writes on the CF card, resulting in lockups.

Sigh.

So, she's in a state of undeath right now. All the data is still there, except for a bit of filesystem damage when blocks were suddenly not being written as they should. Incidentally, the kernel ext2 driver panics a bit and causes the filesystem to be emergency-remounted read-only. No writability means I'm not able to start X, which is a bit of a bummer.

Anyway, bottom line:

No, you can't easily turn a CF card into a budget SSD. You can use it for an embedded system, if you carefully set everything up so there's practically NO writing to disk, like a LiveCD? - but my laptop doesn't really have the RAM to keep the whole system in memory.

You can't expect to use it as a general-purpose computer. Even though I'd been fairly careful in reducing writes, it still wasn't enough. Lockfiles, logfiles, caches, user preferences, mini-databases, all these tiny things contribute a lot to the write limit, and if I'm using it as a general purpose computer, I'm periodically copying video, mp3s, installing software, removing software, even -configuring- software will result in some writes.

So. It sucks, but there you have it. I'm not unhappy with my experience; it was interesting, and I get to tell you guys about it ;)

-Neko


Flash types

Wearing out NAND

Wear Levelling

Adapters

File system choice

Filesystems:

Options:

FUSE combinations:

Block sizes:

Journal stuff

Swap stuff

Kernel IO Scheduler

You can see the current scheduler by looking in sys:

cat /sys/block/sda/queue/scheduler

Adding a kernel parameter apparently lets you change the scheduler:

elevator=deadline

Making things bootable

SYSLINUX

To make my little CF1G card bootable, I had to:

DEFAULT /casper/vmlinuz
GFXBOOT bootlogo
APPEND  file=/preseed/ubuntu.seed boot=casper initrd=/casper/initrd.gz quiet splash --
LABEL live
  menu label ^Run Ubuntu in Persistent Mode saving and restoring changes
  kernel /casper/vmlinuz
  append  file=/preseed/ubuntu.seed boot=casper persistent initrd=/casper/initrd.gz quiet splash --
LABEL live-install
  menu label ^Install Ubuntu
  kernel /casper/vmlinuz
  append  file=/preseed/ubuntu.seed boot=casper only-ubiquity initrd=/casper/initrd.gz quiet splash --
DISPLAY isolinux.txt
TIMEOUT 300
PROMPT 1
F1 f1.txt

Done. However, check the pitfalls section.

Oh, and the version I've used doesn't seem to actually give a damn about the menu structure. (ahah, this is due to the version of SYSLINUX I used, plus the fact that the fancypants menu you see on the LiveCD? is actually done via "GFXBOOT", the special fancypants extension to SYSLINUX)

GRUB

Usually:

However, I've got an "Error 15" (file not found) to contend with. More later.

Attempting to do it from yang (was very annoying because of GNOME treating 'eject' like 'throw away this disk I never ever want to see it again' rather than merely 'unmount'. Thanks GNOME!)

grub> find /8g_usb
 (hd1,0)
grub> geometry (hd1)
drive 0x81: C/H/S = 983/255/63, The number of sectors = 15794175, /dev/sdb
   Partition num: 0,  Filesystem type is fat, partition type 0xb
   Partition num: 1,  Filesystem type is ext2fs, partition type 0x83
   Partition num: 2,  Filesystem type is fat, partition type 0xb
grub> root (hd1,0)
grub> setup (hd1)
 Checking if "/boot/grub/stage1" exists... yes
 Checking if "/boot/grub/stage2" exists... yes
 Checking if "/boot/grub/fat_stage1_5" exists... yes
 Running "embed /boot/grub/fat_stage1_5 (hd1)"...  17 sectors are embedded.
succeeded
 Running "install /boot/grub/stage1 (hd1) (hd1)1+17 p (hd1,0)/boot/grub/stage2
/boot/grub/menu.lst"... succeeded
Done.

Pitfalls

Attack Plan

/etc/sysctl.conf

To minimise writing as much as possible a'la "laptop mode", and avoid using the HD for up to 10 minutes at a time:

vm.dirty_background_ratio = 20
vm.dirty_expire_centisecs = 60000
vm.dirty_ratio = 40
vm.dirty_writeback_centisecs = 60000 

Partition layout

Rough guides to how much space I'll need:

32GB CompactFlash?:

Boot times

Using time read, from moment of Enter in GRUB to moment Ubuntu makes it's little "ready for login" noise

Before:-

real	2m23.968s
real	2m23.775s

After:-

real	1m59.903s
real	1m58.631s

Links

Would anyone like any toast?