Thursday, March 8, 2012

How to Optimize SSD Drives in Linux

1.  First make sure that you have your SATA mode set to "AHCI" in your motherboard's BIOS this is a necessary step for Trim support.

2.  Next you must edit your fstab file to include "noatime" & "discard" mounting options for your file system we do this be executing the following:

sudo gedit /etc/fstab

Enter the following options:


You do not need to do anything to your "/boot" partition just the root file system "/" or any other partition layout you have such as "/home" it should look something like this when you're finished....

After entering the above text Save & Close the file.

3.  Next we should change your I/O scheduler.  Assuming you haven't compiled your own custom kernel you're probably using the "CFQ" I/O scheduler.  For optimal performance we want to use either "Deadline" or "Noop".  To check which scheduler you're using enter the following into Terminal:

cat /sys/block/sda/queue/scheduler

The output should look something like this:

noop [deadline]

As indicate by the brackets I'm running the Deadline I/O scheduler.  To change your I/O Scheduler you can either compile your own custom kernel if you're unsure how to do that I have multiple videos covering the topic or you can do it in userspace by editing your /etc/rc.local file.

In Terminal enter the following:

sudo gedit /etc/rc.local

Next you will add the following to this file:

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

It should look like this when you're finished...

After entering the above text Save & Close the file.

4.  For changes to take effect reboot your computer and enjoy!