Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[mini-HOWTO] SSD on laptops in addition to HDD (50€ upgrade)
View unanswered posts
View posts from last 24 hours

Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message

Joined: 16 Jun 2007
Posts: 26

PostPosted: Sat Dec 27, 2008 5:33 pm    Post subject: [mini-HOWTO] SSD on laptops in addition to HDD (50€ upgrade) Reply with quote

I've been using gentoo for years on most of my machines, and a few months ago I had an idea for making my old laptop viable again. I researched it pretty exensively, and implemented it to full satisfaction. There are a million options for adding SSD to your laptop, so I thought I'd post a small writeup to share with the community.

The issue: I have a 5 year old laptop with a 1.5Ghz Banias Pentium-M, a great 1400x1050 screen, built-in bluetooth, 11g wlan etc, cardbus slot, 2G DDR. I year ago I maxxed out the memory for about 50 euros, other than that the only upgrade I ever did to it was changing the 30G IDE drive for a 250G one (which is the biggest one you can get) a few months ago, so I could use it for backing up essential files. Unfortunately this also meant going from a 4200rpm drive to a 5400rpm one (you can't get 4200rpm drives anymore). Since the fan only spins if you load the CPU 100% for more than a minute, this meant the laptop went from dead silent to a constant whirring sound from the drive. It draws 7-10W depending on if the screen is on, so I tend to keep it on all the time which means the whirring is annoying.

The idea: adding solid state storage of some form, to store the root partition, /home, /var etc, so the HDD can be spun down all the time when not using the HDD for backups. I've inlcluded options for newer laptops with expresscard slots as well.


1. The mainstream option: A "true" SSD disk (IDE/SATA interface)
- The biggest IDE SSD you can get for a reasonable price is the Transcend TS32GSSD25-M which costs about 60 euros.
- SATA SSD options are increasing, at the moment a 64G one costs about 100E, or 60E for a 32G one.
- All the cheap drives use MLC flash (wiki)
- This option means you lose your HDD drive, unless you have one of those laptops with two disk slots (in which case it's probably the best option for you)

2. An alternative in the IDE or SATA slot using single or dual Compactflash adapters
- CF cards are weird creatures that can be hung off of a lot of buses relatively easily. This is due to the fact that CF cards support multiple standards for accessing them, the wiki has details. There's a good conversion compatibility chart for all types of memory cards, also on the wiki.
- By using a dual cf to ide adapter, for about 125E you can get 64GB of flash into a single IDE slot, which is more than the biggest available SSD. This company has all the converters you'll ever need, including the simple single-CF case. Two CF cards show up as two disks so all kinds of funky tricks like RAID are possible (see /usr/src/linux/Documentation/md.txt).
- There are CF to SATA options available, too, but they are less attractive than in the IDE case, since they contain a converter chip to make the CF card's native IDE talk SATA. The chip uses extra power (unatractive in a laptop), and there are more SSD options for SATA buses anyway, but it might be an option for you if you have a SATA laptop and already have a big CF card lying around.

3. For newer laptops: Using the expresscard slot
- Expresscard is a 1x pci-e link and an usb link bundled into one slot. So either you have flash storage off of a mass storage chip on the pci-e bus, or you have a usb stick in expresscard format. There are cards available for the pci-e bus, but they are absurdly expensive for the storage they offer (they are also very fast). The usb option is probably the best choice for people with an expresscard slot as they can be had for about 50E for 16GB, not much more than an equivalent USB stick would cost you.
- A warning: I have not tried this myself, and you might have trouble with suspend/resume if using usb flash for a root drive, as some buses need to be reset when resuming.

4. An idea for older laptops: Using the "pc card" slot for compactflash
- A lot of people have cheap CF to PCMCIA adapters. These cost next to nothing since they have no electronic components (see compatibility chart at the wiki, link above). However the performance is abysmal, usually less than 1MB/s which you don't want on a root drive.
- Using a cardbus CF adapter. This is the option I chose for my laptop. It's basically a cardbus card (not pcmcia, see wiki link above for difference) with an IDE controller that presents the CF card as an extra drive off of a pci controller. They are pretty hard to find nowadays since most of them are out of production, but they pop up on ebay from time to time, and there are some webshops that are still selling them (for the likes of 10 euros). Brand names are Delkin/ASKA/Workbit and many others, pretty much all of them are supported by the "CONFIG_BLK_DEV_DELKIN" driver in the kernel (or "CONFIG_PATA_NINJA32" for libata). Performance is OK and it's a native PCI solution.

5. For laptops with builtin card readers that show up on USB:
- Grab the biggest card you can afford and see this thread.

6. For laptops with card readers that use the MTD driver: (aka using "real" flash rather than an IDE- or SATA-ified version)
- Flash is not really a block device. If you have such a laptop (I believe a lot of common SD card readers are like this?), you want to skip all this IDE adapter nonsense, grab a recent kernel, and start reading up on ubifs.
- There are also PCMCIA cards which export "real" flash and which are supported by the MTD driver. However these are either really expensive or really small. I've not been able to find an expresscard version. If you can prove me wrong on these two points, I'd love to hear about it.
- Big disadvantage: since flash filesystems do not operate on block devices, you can't encrypt them with standard kernel drivers like dm-crypt. This is a show-stopper for me since I use full root drive encryption (this post is about laptops after all). There are ways to make MTD emulate a block device on the flash, but from what I've read these all have performance issues.

7. Esoteric adapters and combinations of adapters
- You could grab a cardbus to expresscard adapter like this one (yes, they exist!). This is really just a pci to usb chip in a convenient format. It enables you to chose option 3 on laptops without a expresscard slot, and is a fairly cheap option, too. Big advantage: incredibly easy upgrade to a new laptop. Just remove your flash expresscard from your old laptop and plug it into the native expresscard slot on your new one (provided compatible CFLAGS, avoiding -march etc). And you can use the adapter for other things like WAN cards (UMTS), some of which are not avaiable in cardbus anymore.
- CF cards are the most compatible (you can always hang them in your desktop PC off the IDE bus if you want) and the cheapest per GB, but instead of using CF cards you can use most any big storage card with a CF adapter. For example see the link above for a SD to CF adapter.
- You want to avoid PCMCIA adapters for any card type, since they usually perform abysmally. I believe most of the multi-to-expresscard adapters are USB devices, so if you have a big enough SD card you want to use, you can pick those. Else just go for a CF card.

8. If I've missed any options, I'd love to hear about them!


1. Whatever option you've chosen, you should end up with a block device, so setup should be the same as on any normal HDD (unless you're using MTD, in which case see the MTD pages and lists). If you're migrating from a HDD, you want to partition the flash device and move your data over, after which you can repartition the HDD.

2. Special attention should be paid to booting. A lot of BIOSes can boot off of usb drives, so if you're using that option you want to setup grub on the flash device itself. In my case the BIOS did not see the contoller, so my /boot partition continues to live on the HDD, with the root partition on the flash. The hard drive is spun down after boot (add "/sbin/hdparm -y /dev/hda > /dev/null" to /etc/conf.d/local.start, and see man hdparm for inactivity timeout options).

3. Easy failover and backup solutions: If you do boot from the flash, one option could be to setup a raid1 for the /boot partition with the flash and the HDD as members. That way, you can always boot into an initrd even if the flash is removed. A lot of stuff is possible, since the flash will likely be a small fraction of the HDD's size, you could even make a raid1 of the whole flash with part of the HDD, which you don't assemble at boot, but only when you want to backup the flash to the HDD, as a really simple backup solution for if you lose the flash device.

4. Root encryption might also be a good idea with the root filesystem living on an easily removable device, but the same principles apply as on any block device, so see the relevant HOWTOs on the forum and gentoo-wiki.

5. One thing to keep in mind is that all flash has a limited write cycle (well, all devices do, but it's said to be more limited than that of HDDs). The manufacturers implement wear leveling algorithms below the block layer (linux flash filesystems do something similar). A lot of myths surround this issue, but it would be wise to defer the writing of large, temporary files to the HDD instead of the flash. If not for the wear leveling, then because the write performance of the HDD will certainly be better. What this means for you depends on what applications you run and how they access files, but for a gentoo system in general, you might want to:
- Change your PORTAGE_TMPDIR to a directory wich lives on the HDD, to make gentoo do compilations on the HDD. You might want to move the portage tree there also (mine lives on the network).
- Disable swap. You don't want swap writes going to the flash, if at all possible. My laptop has 2G RAM and lives just fine without swap (you want as much RAM as possible, because the flash most likely *will* be slower than your HDD, and lots of RAM gives the kernel space for file and write caches). If you regularly use more RAM than you have, you want to keep the swap on the HDD, and might want to tweak the vm.swappiness sysctl.
- If you use hibernation, make sure you hibernate to a store on the HDD and not on the flash (the HDD will likely be spun up by the BIOS when you boot anyway, so you might as well use it).

6. Keep in mind that for affordable flash atleast, its main strength is access time, which is several orders of magnitude better than that of HDDs, however write performance in particular is a lot worse. For example, my laptop boots ~10 seconds faster from the flash, but sequential write speeds are only 1/10 that of the HDD (reads are about 1/3-1/4). With the kernel's smart write caching, this is not an issue. Total cost was about 50€, 15 for the CF to cardbus adapter and 35 for a 16G CF card (8G was too small for root + /home).

7. Resouces: This is a good thread on the thinkpad forums that gave me some ideas, and contains some performance numbers for the vairous hardware setups.
Back to top
View user's profile Send private message
Tux's lil' helper
Tux's lil' helper

Joined: 26 Jul 2008
Posts: 123
Location: Polska

PostPosted: Fri Jan 02, 2009 11:11 pm    Post subject: Reply with quote

This is all very interesting. Where did you buy the Cardbus -> CF adapter ? This one part seems to be the hardest one to find. Also, what CF card have you used. Can you post some benchmarks ?
Maciej Grela
You just keep on trying till you run out of cake.
Back to top
View user's profile Send private message

Joined: 16 Jun 2007
Posts: 26

PostPosted: Tue Jan 06, 2009 8:05 pm    Post subject: Reply with quote

Unfortunately it looks like you'll have to ebay that, since the shop I bought it from a few months ago is no longer selling it. I did some extensive searching back then and it was the only shop I could find that still had stock, but I'd love to be proven wrong. Search for the brand names I mentioned, or for Delock/Viking, which also used to make them.
If you do find a controller, the CF you get won't really matter since the speed will be limited by the controller. I just got the cheapest CF I could find, which was a 133x card. For the CF->IDE adapters and such, you might want to invest in a 300x card, but they are a lot more expensive and I don't think the speed benefit would be worth it.
I haven't found a decent linux benchmark tool, but here are some windows benchmarks with CrystalDiskMark with my setup:
Sequential Read : 10.806 MB/s
Sequential Write : 8.047 MB/s
Random Read 512KB : 10.728 MB/s
Random Write 512KB : 1.537 MB/s
Random Read 4KB : 7.408 MB/s
Random Write 4KB : 0.013 MB/s
Test Size : 100 MB

Typical for non-expensive CF: there's a big penalty for smaller writes, bigger than that of HD's. It's not a problem in practice since the kernel caches writes anyway. I'd say from dd tests that the speed with the linux driver is about half that of the windows one, but the system feels much faster due to much lower read latencies.
Back to top
View user's profile Send private message

Joined: 21 Jan 2003
Posts: 214

PostPosted: Sun Jan 11, 2009 1:52 am    Post subject: Reply with quote

Thanks for valuable info. I was need it :-)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum