[mdlug] Some SSD notes

Ingles, Raymond Raymond.Ingles at compuware.com
Thu Jan 16 09:43:00 EST 2014


As I've said before, I recently put my root partition onto SSD, while keeping my /home directory on standard hard disk. Taking advice from several articles on the web, I did the following tweaks to help the SSD system work more smoothly:

1.      Set up a daily TRIM operation on the SSD.

This essentially advises the SSD which blocks are being used by the filesystem and which are not. This allows the SSD to more efficiently allocate, clear, and remap blocks, which speeds writing files considerably. There are a couple ways to do it; you can add the fs option "discard" to the mount options in the fstab, but apparently this can cause some noticeable overhead in normal file operations. Better is setting up a daily cron job to do the TRIM housekeeping, and get that overhead out of the way all at once. (References: https://patrick-nagel.net/blog/archives/337 http://www.webupd8.org/2013/01/enable-trim-on-ssd-solid-state-drives.html )

2.      Add the 'noatime' and 'nodiratime' mount options to the root listing in /etc/fstab

Unix filesystems typically keep track not just when a file was created or modified, but also when they are accessed. (Linus Torvalds has noted that causing a write operation for every read operation is pretty wonky...) Some software actually uses this (a few mail programs use it to check for unread mail, some backup tools, etc.) but mostly it's not that big a deal, and minimizing such writes can boost performance (and disk life) noticeably. I'm also pondering changing that to 'relatime' but we'll see. (References: http://linux.koolsolutions.com/2009/01/30/installing-linux-on-usb-part-4-noatime-and-relatime-mount-options/ )

3.      Use tmpfs to minimize disk writes

Some file information can be kept in RAM instead of on disk. Generally this should be stuff that doesn't need to survive a reboot. Linux supports the 'tmpfs' filesystem (https://en.wikipedia.org/wiki/Tmpfs) which essentially creates a RAM disk to store a directory tree. I've got /tmp, /var/spool, and /var/tmp mounted as tmpfs (see http://apcmag.com/how-to-maximise-ssd-performance-with-linux.htm ). (Of course, I have plenty of RAM. If your system swaps a lot, this might not be the way to go. Better still, get more RAM!)

Other references:
http://www.howtogeek.com/62761/how-to-tweak-your-ssd-in-ubuntu-for-better-performance/
https://wiki.archlinux.org/index.php/Solid_State_Drives
https://wiki.debian.org/SSDOptimization

Hope this might save someone else some time or trouble!



More information about the mdlug mailing list