I recently bought an awesome new ASUS G53SW and to go along with it I purchased a 128 Gb Plextor SATA III SSD. I wanted to use the SSD for the Mint Linux OS.
It seems that there are a ton of older articles that talk about getting an SSD correctly configured in Linux. I perused through them and I found several conflicting and incorrect instructions. In the following tutorial I am going to try to present what I have learned, both how to configure and why it is configured that way.
These instructions should work for all Debian based Linux Distros (Ubuntu Mint). Some of the commands may need to be tweaked for Fedora or others.
Before I begin let me just gloss over the paradigms behind SSD drives. SSD drives are fast compared to the traditional hard drives. Traditional hard (7200 rpm) drive get less than 100 Mb/s read rate which degrade over time. SSD’s with SATA III I have seen with speeds at 500 MB/s. So with SSD’s your application load times are reduced by 80%. However SSD’s are more expensive smaller and as they are written to they lose disc space, leading to a short life time if they are written to too much.
Hard Drive Speeds: http://answers.yahoo.com/question/index?qid=20110309132315AACvk6n
More on SSD Technology: http://www.storagesearch.com/bitmicro-art3.html
Before you Buy — Is the SSD compatible with your Hardware?
If your computer is new chances are it supports SATA III for its hard drives. If your computer is older check to see what SATA your computer supports. No sense in buying a SATA III device if your computer only supports SATA II. SATA III is completely backwards compatible with SATA I, II but will only get speeds at the SATA I, II levels.
Before you Install — Linux Partition Type
Before you install Linux you will want to consider the partition type. The partition types for a Linux install are ext2, ext3, ext4. There is a fair amount of dispute as to which is best. There are a lot of fans of ext2 and ext4. The default install of most (or all?) linux distros is ext4. Ext4 is a journaled file system. The journal is there for redundancy in the event of hard drive error/failure. It is a lot easier to recover your data with and ext4 system, however the journal adds writes to your SSD. The ext2 partition type does not have a journal so the life of the SSD is lengthened, but it loses the recovery features. Ext3 is a journaled file system with less features than ext4 so it is typically rejected in favor of ext4.
More info on ext2, ext3, ext4: https://ext4.wiki.kernel.org/index.php/Frequently_Asked_Questions#Can_I_use_ext4_on_Solid-state_drives_.28SSD.29.3F
In the article listed below a pro ext4 person explains his viewpoint that the lifespan of the SSD is so long that having a journaled file system won’t be a big deal unless you plan on using the drive for more than 10 years. I would suggest that for any desktop user ext4 is a good choice. If you are installing the ssd for a server then you might think about ext2 as long as you keep good backups.
Ext4 suppoter: http://marc.info/?l=linux-ext4&m=125803982214652&w=2
After Linux Installation — Know Your Hard Drives
If you have multiple hard drives connected to your Linux machine you will want to know which hard drive the name of the hard drive. If you go to your terminal and type in “df -h” you should see something like this.
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sdb6 89G 9.2G 76G 11% /
none 4.9G 588K 4.9G 1% /dev
none 4.9G 536K 4.9G 1% /dev/shm
tmpfs 4.9G 1.6M 4.9G 1% /tmp
none 4.9G 396K 4.9G 1% /var/run
none 4.9G 0 4.9G 0% /var/lock
tmpfs 4.9G 0 4.9G 0% /var/tmp
/home/chris/.Private 89G 9.2G 76G 11% /home/chris
/dev/sda2 466G 54G 413G 12% /media/Windows Starace
/dev/sdb1 26G 9.5G 16G 38% /media/Windows SSD
/dev/sda1 100M 25M 76M 25% /media/System Reserved
Looking at this screen you can tell that I have two hard discs and a couple partitions on each disc. The entries with /dev/sda and then some number are partitions that are on my 7200 rpm Seagate traditional hard drive while entries with /dev/sd2 are partitions on my 128 Gb Plextor SSD. Knowing that the the ssd’s name is “sdb” is important for the upcoming steps. Most people will probably have their ssd name be sda so I will use that in the rest of the tutorial.
After Installation — Changing the Linux Disc Scheduler
The hard drive scheduler attempts to organize hard drive requests in a way that is efficient. However organization is so old school. With SSD’s the memory access is instantaneous and many of the schedulers that were designed for spinning hard drives will only get in the way of SSD performance.
There are four types of schedulers in the Linux World. Anticipatory, Completely Fair Queuing, Noop, and Deadline. Anticipatory scheduling tries to arrange hard drive reads in a way that will maximize efficiency on a spinning disc. Completely Fair Queuing (cfq) is an anticipatory scheduler that adds in a ranking system for important disc reads. Neither of these are suited for an SSD.
The noop is a simple first in first out queue. The deadline is a biased noop queue that allows an application to get some access to the disc even if another application has already requested it.
The deadline is the best scheduler because it has more features than the noop and doesn’t worry about a rotating disc like cfq. To see what scheduler you are currently using go to your command line and look at this file
You should get something that looks like this
noop deadline [cfq]
The option in brackets is the scheduler that is currently being used by your system, notice that this is currently the cfq. We want to change this to deadline. To do this we are going to edit the file /etc/default/grub. Type “sudo gedit /etc/default/grub” to edit the file. There should be a line of code that looks like this
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash elevator=deadline"
To make the scheduler add in the elevator=deadline option that is highlighted in red. Be sure to put a space after the previous option. You may have more options than I do and that is perfectly fine. After you make this change reboot your computer. Run the “cat /sys/block/sda/queue/schedule” command and deadline should be bracketed.
Wikipedia on Schedulers: http://en.wikipedia.org/wiki/Noop_scheduler
Tombuntu on Grub: http://tombuntu.com/index.php/2008/09/04/four-tweaks-for-using-linux-with-solid-state-drives/