Install Linux on an SSD
When you want to install Linux to an SSD, there are a lot of things to think about. This wiki post will look at all those things.
1. start your partitons on a 4k boundary
Because SSD's use 'blocks' of 4k in size, you must line up the partition boudaries on a block boudary for the best performance.
In fact, it is even better to start your partitons on a 512k block boundary. To do that, start fdisk with the parameters '-H 32 -C 32 -c' and create a completely new partitiontable.
fdisk -H 32 -C 32 -c
Note: Intel SSD's uses smaller blocks so use a different command:
fdisk -H 16 -S 16 -c
2. Optimize I/O
To adjust the stripe width and stride of an EXT4 filesystem, use this command to create a new filesystem:
mkfs.ext4 -E stride=128,stripe-width=128 /dev/sdaX
where sdaX is of course your ssd partition.
To tune an already existing filesystem, you can use:
tune2fs -E stride=128,stripe-width=128 /dev/sdaX
Intel users should use the value 32 for the stripe width
Use a different scheduler
You can also use a different i/o scheduler, the deadline scheduler, because the one that is used as a standard in the kernel is optimized for magnetic hard drives.
Modify /etc/rc.local (or /etc/rc.d/boot.local on openSUSE) and insert just before 'exit 0'
echo deadline > /sys/block/sda/queue/scheduler
3. Use TRIM
3.1 first, check if your SSD supports the TRIM command
hdparm -I /dev/sda | egrep "Enabled|TRIM"
3.2 second, your kernel needs to be > 2.6.33
uname -r
3.3 without special mount options, TRIM will not be used. To enable TRIM, use the 'discard' mount option in /etc/fstab.
/dev/sdaX / ext4 discard,etc. etc. etc.......