SSD or HDD?

The warning of some bad sectors on my hard disk drive told me that I needed a new disk soon, before data loss caught up with me. I know that SSDs are faster than HDD, though the capacities are lower and the cost is greater; but is that extra speed worth it in actual use?

I’ve not really bothered with hard drive speed when I’ve built computers in the past, I was always more interested in the processor speed, or making sure that the RAM was large enough that the operating system didn’t need to use the swap space on the drive in normal operation. I have SSDs in my eeepc, and I’ve installed a hybrid drive in a laptop, to some very impressive startup times; the eeepc starts up quicker than my core i5 desktop, even though it’s a lot slower overall.

Choosing an SSD over an HDD is expensive, a reasonable 1Tb drive is around the £45 mark at the moment (approx. 4.5 pence/Gb), while a 60 Gb SSD is twice the price (and over £1.50/Gb), so the increase in speed has got to be worth it. While a 1Tb HDD might have a read speed of 125MB/s and an average latency of 4.17ms (Seagate Barracuda 7200.12), the SSD I chose to try (OCZ Vertex 2 SATA II 2.5” SSD) has read speeds up to 285MB/s, writes up to 275MB/s and has a latency of only 0.1ms – which is pretty impressive!

As it is, the low capacity isn’t a problem for me, as I’m only using around 15 Gb of my current 80 Gb drive, with all of my large media files on a network drive on another computer. It would equally be possible to use a small boot-drive SSD with a second, larger HDD as a storage drive in the same computer.

I did steer clear of the OCZ _Onyx drives after I looked at the transfer rates. At 170 MB/s read speed, they didn’t seem as impressive as the Vertex 2 drives, as they are still ¾ of the price. They might be a lower cost solution though, where quiet operation of an SSD is more important than the greater speed._

Startup Time

I actually had no idea of the speed of the outgoing HDD that I have been using as a boot drive; I didn’t even buy it. As a cast off part from a computer I’d previously adopted, it was just a spare SATA drive that I had available. Now that I’ve tested it, I know that it was never going to win any races. With an average read rate of 49.2 MB/s (max 60.5, min 31.4) and average latency of 16.8ms, I’ve got PATA (IDE) drives that are as quick.

Rather than just take the manufacturer’s word for the speeds, I tested the new SSD too. Average read speed was 255.0 MB/s (max 272.4 MB/s, min 200.2) with an average 0.2ms of latency. So the new SSD is easily 5 times the speed of the disk it replaces, but how does this convert to performance you can see?

Boot times, power off to surfing the internet (from pressing the power button to full operating system function, including opening a web browser (chromium) and it being responsive to input):

  • HDD: 2min 28·7 sec (of which 19·6 seconds is POST)

  • SSD: 42·7 sec (of which 19·6 seconds is POST)

Which is a very noticeable difference in the morning! But the good news doesn’t stop there, programs that I used to have to wait for load really fast.

Program start times:

  • Libreoffice spreadsheet

    • HDD: 7·0 sec

    • SSD: 1·6 sec

  • QTOctave

    • HDD: 6·5 sec

    • SSD: 3·2 sec

Ubuntu Encrypted Home Directory

Becasue I’m moving to a smaller disk, I cant just dd the disk and expand the partitions. Instead I opted for a fresh Ubuntu install and to copy over my home folder contents. I’ve done this before with my eeepc (where the boot drive isn’t large enough to hold the files for an upgrade) and it’s refreshingly easy. Because all of the program preferences are stored in hidden files in my home directory, the fresh install still had all of my options, I just had to reinstall the extra programs I use.

This time however, I was moving from an encrypted home folder and needed some way of getting access to the original folder to be able to copy the old files accross. As it turns out, it’s not difficult – the ecryptfs encrypted information can be mounted from the command line – but it needs a couple more commands for the decryption.

eCryptfs will decrypt data using one of two passwords; either the user’s login password, when the user logs into their desktop; or the mount passphrase. I recorded the mount passphrase when it was generated at the Ubuntu install time, but it is possible to recover the mount passphrase using:

`ecryptfs-unwrap-passphrase /home/username/.ecryptfs/wrapped-passphrase`

To manually mount the original home directory, boot into the fresh ubuntu install and mount the old drive:

`sudo mount /dev/sdb1 /mnt`

Where /dev/sdb1 is the location of your old drive. Use sudo fdisk -l or check in Disk Utility to find the order that your drives were loaded.

The original, encrypted home directory is then at /mnt/home/.ecryptfs/username/.Private/

Ubuntu 10.04 uses encrypted filenames as standard, so an additional passphrase is needed to decode them. Run:

`sudo ecryptfs-add-passphrase --fnek`

And enter the mount passphrase for the original, encrypted home folder. Two tokens will be inserted into the user session keyring. Copy the second one (in the square brackets); you’ll need it to decrypt the filenames.

Then mount the encrypted folder:

`sudo mkdir -p /mnt/home/username/Private sudo mount -t ecryptfs /mnt/home/.ecryptfs/username/.Private/ /mnt/home/username/Private Passphrase:` (Enter the _mount_ passphrase) ` Selection: aes Selection: 16 Enable plaintext passthrough: n Enable filename encryption: y Filename Encryption Key (FNEK) Signature:` (Enter the value you recorded from above)

And you can access your old files at /mnt/home/username/Private


Disk performance was measured using the Disk Utility benchmark test in Ubuntu (System > Administration > Disk Utility > Benchmark). I’ve only done read tests, as write tests overwrite the disk.

Further information on eCryptfs in Ubuntu can be found at help.ubuntu.com/community/EncryptedPrivateDirectory