SSD disks and Linux

I had read lots about the performance boost you should get using SSD disks. Since I was going to make a clean install of operating system anyway, I thought I could give it a try. Since my Acer Aspire 8930 has two hard disk bays, I installed one 64 Gb SSD disk and one 360Gb SATA disk. SSD disk is boot disk, of course.

After installation, you really could see the difference. Boot was astoundingly fast. It only takes couple of seconds to show login screen, and couple of seconds more to have fully operational desktop. Programs launch really quickly. But to get full performance boost, you should do couple of tricks, you can do them after installation as I did. I wanted to test things with normal installations, and then see how tweaking might change performance.

Since SSD disk excels in reading speed (but not in writing speed), we should avoid writing to SSD disk as much as possible. I am only concerned with performance, not at all how many write operations those cells on SSD can take. Writing can be a real bottleneck for performance. So we should avoid journaling on SSD.

But journaling isn’t all. You should also avoid having /tmp and /var/tmp directories on SSD disk. Best way is to have them as ramdisks, assuming that you have lots of RAM to use (most modern machines have). This is important especially if SSD disk is the only disk drive you have on your machine.

Installation

Since I had 2 disk drives (1 SSD and 1 SATA), I installed them so that SSD was root disk (mount point /) and traditional SATA drive was used for user data (mount point /home). Both drives were formatted as ext4 with journaling (I’ll explain later how to turn off journaling on SSD disk). Otherwise installation is quite normal.

After installation

When you have operating system installed and updated, you can immediatelly tweak it to have even more performance.

First we have to tune filesystem in order to allow data=writeback option on root partition. This has to be done using liveCD (You can do this by dropping to single-user mode, but LiveCD is safe method). Good choice is most recent Ubuntu Live/Installation CD. When booted find out what is your root partition. It is /dev/sdxx, in my case it was /dev/sda1. Open terminal and write


tune2fs -o journal_data_writeback /dev/sdxx

substituting xx with actual id of root partition. After this reboot machine, take out LiveCD, and boot normally to Linux.

After this edit fstab as follows


UUID=something / ext4 noatime,barrier=0,data=writeback,nobh,commit=100,errors=remount_ro 0 1
UUID=something-else /home ext4 noatime,barrier=0,data=writeback,nobh,commit=100 0 2
UUID=something-different none swap sw 0 0
tmpfs /tmp tmpfs exec,defaults,noatime 0 0
tmpfs /var/tmp tmpfs exec,defaults,noatime 0 0

What this means? noatime means that access time of data will not be written every time it is accessed, nobh avoids buffer heads and data=writeback means only meta-data journalling. Reboot the machine and you should experience boosted performance.

If you are using your machine in your home as a single user, you may add nouser_xattr to root and home partition optionlists.

Leave a comment

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 105 other subscribers