SSD In Linux

Posted on Mon 19 September 2011 in misc

In an effort to make my Dual Core 1.6 Centrino laptop perform abit better I thought I would splash out on a SSD. I picked this up for £75 http://www.ocztechnology.com/ocz-vertex-2-sata-ii-2-5-ssd.html By the way my laptop is only SATA 1.

A quick google of SSD Linux shows alot of different ideas and I thought I would record the ones I used.

BTW a quick benchmark of my previous SATA 1 Toshiba 60GB 5400 2.5 drive with[ hdparm -t]{.Apple-style-span} showed about 30MB/S.

Here's the steps I used.

1. Disk alignment

I used this guide http://www.ocztechnologyforum.com/forum/showthread.php?77769-A-Simple-How-To-on-Partitioning-and-Alignment-on-GNU-Linux-using-fdisk which basically says, make sure each partition starts on a sector that is divisible by 512.

I quickly knocked up a OpenSUSE live usb stick (dd_rescue openSUSE-11.4-KDE-LiveCD-x86_64.iso /dev/sdX)

I then fired up fdisk with sudo fdisk -H 32 -S 32 /dev/sda and created a 3 partition layout. fdisk offered to start the partition on a sector divisible by 512 so very little work was needed here.

NB On a fresh install of OpenSUSE 11.4 and no optimisations hdparm -t was giving 117.45 MB/sec - already almost 4 times quicker!

2. Change Disk Scheduler

Given that disks have been on various patters before SSD's, operating systems have therefore been optimised for them by default. http://www.gnutoolbox.com/linux-io-elevator/ This describe them all. You can see which one your are currently using by doing

cat /sys/block/sda/queue/scheduler

based on http://tombuntu.com/index.php/2008/09/04/four-tweaks-for-using-linux-with-solid-state-drives I am going to use deadline scheduler and set the /sys/block/sda/queue/iosched/fifo_batch to 1

So in /etc/rc.d/boot.local I added:-

echo deadline > /sys/block/sda/queue/scheduler

echo 1 > /sys/block/sda/queue/iosched/fifo_batch

3. Enable TRIM (http://en.wikipedia.org/wiki/TRIM)

This is easily enabled in any >= 2.6.33 kenel via fstab. Here's my entry for /

/dev/disk/by-id/ata-OCZ-VERTEX2_OCZ-F1B8655OI4BKW33W-part2 / ext4 noatime,acl,user_xattr,discard 1 1

4. Disable noatime <http://en.wikipedia.org/wiki/Stat_(Unix)

Add the noatime option to fstab (see above example)

SSD