Wednesday, July 22, 2009

ubuntu SSD hints

Preface: Any good CompactFlash card will work as an IDE drive with a very very cheap adapter. CF operates in three modes - memory map?, PCMCIA, and true IDE mode. siliconkit has one good line, monoprice has a decent cheap one as usual, and newegg has some too. For those who never want to buy old 80-wire IDE kit again, you can also get CF->SATA adapters for ~$20-30.

TL;DR flash-based hard drives have existed for years right under your nose, and they are dirt cheap.

---

I've always liked the idea of SSD's, and now with cheap 4GB CF's (Costco blew them out for $10/ea a while back) you can fully install ubuntu, as long as you don't plan to rip DVD's, load eclipse with every plugin known to man, or things like that.

However, the typical Sandisk Ultra II card is 'only' 15MB/sec and isn't fully optimized for SSD use. One can get the faster UDMA-supporting Extreme IV card but those tend to cost more than HD's, so you need a really good reason to have one. So, unless we have the money for that* (let alone an intel X25!) we gotta tweak settings to make things 'feel' fast.

(* - especially if the target box is a hand-me-down P4)

And for those of you who have money for faster flashes - this'll work well on those too. However if your power is flaky, these... er, wait, just get a UPS, your computer will thank you by lasting a bit longer.

First, edit /etc/fstab to make sure the SSD is mounted noatime and nodiratime.

So here's some good tweaks that can be run in /etc/rc.local or better places to set /proc/sys and /sys/... tables.

# laptop mode holds onto writes for a while - up to 10 minutes with this setting.
echo 10 > /proc/sys/vm/laptop_mode
# only swap when absolutely necessary.
echo 0 > /proc/sys/vm/swappiness
# keep 'dirty' pages longer
echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
echo 20 > /proc/sys/vm/dirty_ratio
echo 10 > /proc/sys/vm/dirty_background_ratio
# this scheduler will work better with flash
echo deadline > /sys/block/sda/queue/scheduler

references:

http://ubuntuforums.org/showthread.php?t=1183113
http://www.ocztechnologyforum.com/forum/showthread.php?t=54379&page=2

No comments: