The News‎ > ‎

SSD performance tip 1

posted Dec 14, 2012, 12:23 PM by Leigh Williams   [ updated Oct 8, 2016, 8:45 AM ]
Here is an excellent resource. A bit long but really great!
https://sites.google.com/site/easylinuxtipsproject/bugs#TOC-Hibernate-and-suspend-don-t-always-work-well:-they-make-some-computers-malfunction-or-even-enter-a-coma 


I recently bought myself an SSD hard drive for my old notebook. Well worth it!
You need to make a few tweaks though to get ultimate performance and lifetime out of it. This is one of many performance tips that I will post over the coming weeks.

Add noatime and nodiratime to your /etc/fstab file like so: (Be sure to backup your fstab file first before making any changes)
sudo gedit /etc/fstab
I only have one partition (probably could have added more but didn't feel like it) so I added the following to the sda1 line

# / was on /dev/sda1 during installation
UUID=45474ceb-1607-46d5-8709-515a4f50b44b /               ext4    noatime,nodiratime,errors=remount-ro 0       1

###NOTE!!#####
Since newer Ubuntu versions, you don't need the discard option in your fstab anymore. A weekly cron in /etc/cron.weekly/fstrim will run once a week to automatically trim things. Discard trims every time a file is deleted, which could lead to unnecessary trims.

The discard option (highlighted in black) enables TRIM for your SSD. Read the Wikipedia link for more information: http://en.wikipedia.org/wiki/TRIM
Basically TRIM ensures future write performance of your SSD drive, and can also extend its life.

Below is an extract from https://wiki.archlinux.org/index.php/Fstab that expains the noatime and nodiratime options. Read it carefully! And do not do this on a server or home computer with critical data, especially if you need audit logs.

Noatime and Nodiratime
"The use of noatime, nodiratime or relatime can improve drive performance. Linux by default uses atime, which keeps a record (writes to the drive) every time it reads anything. This is more purposeful when Linux is used for servers; it doesn't have much value for desktop use. The worst thing about the default atime option is that even reading a file from the page cache (reading from memory instead of the drive) will still result in a write! Using the noatime option fully disables writing file access times to the drive every time you read a file. This works well for almost all applications, except for a rare few like Mutt that need the such information. For mutt, you should only use the relatime option. Using the relatime option enables the writing of file access times only when the file is being modified (unlike noatime where the file access time will never be changed and will be older than the modification time). The nodiratime option disables the writing of file access times only for directories while other files still get access times written. The best compromise might be the use of relatime in which case programs like Mutt will continue to work, but you'll still have a performance boost because files will not get access times updated unless they are modified."

Put Google Chrome cache in Memory:
tmpfs /home/sven/.cache tmpfs noatime,nodev,nosuid,size=1024M 0 0

Put /tmp in Memory:
tmpfs /tmp tmpfs defaults,nosuid,nodev,size=2048M,mode=1777 0 0

Comments