My *nix world

Gentoo before and after SSD

I have decide to give a try to SSD technology, even if it's not that cheap nowadays.
So, I have bought a Corsair Force 3 SSD 90GB (which supports SATA III too) and replaced the old Toshiba 160GB 5400 rpm HDD.

Using the old 5400 rpm HDD I could boot my system in about 20 seconds:

gentoo before and after ssd

click to zoom

Using the new SSD my system boot in about 12 seconds:

gentoo before and after ssd

click to zoom

It worth also mentioning that from the date when I have measured the HDD boot time (~20sec) until today when I measured the SSD boot time (~12sec) I added also many other daemons/session startup scripts, so they could also affect the current boot speed (+2 sec more).

Twelve seconds from boot to the desktop wallpaper is not that bad.

Keep in mind that SSD is not HDD and that's why we must configure little bit differently the Gentoo file system:

  • set /proc/sys/vm/swappiness to minimum (eg: 0 or 1) by modifying the /etc/sysctl.conf parameter called vm.swappiness. You can also disable swap partition (swapoff and change also the fstab)
  • enable TRIM on ext4 in fstab by using discard option
  • mount the ext4 partition by using noatime and discard option
  • according to Wikipedia noop is the best I/O scheduler for SSD so compile your kernel with noop as default I/O scheduler or create a .start script in /etc/local.d/ that will set default scheduler at start-up, as:

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

  • mount /tmp as tmpfs in your /etc/fstab
  • set Firefox cache directory to /tmp/firefox-cache (about:config then set browser.cache.disk.parent_directory=/tmp/firefox-cache)

For /var , /tmp and /usr/portage I am using an external USB HDD where I have dedicated ext4 partitions as following:

  • for /var I have a /sdb1 partion with ext4 file system of about 10GB
  • for /tmp I have a /sdb2 partition with ext4 file system of about 4GB
  • for /usr/portage I have a /sdb3 partition with ext4 file system of about 6GB

The /var and /tmp paritions are heavily used by Linux (for example: logs are saved in /var/log) and that's why you have to mount these /sdb paritions early at boot.

For that I have wrote a runscript (called ssd-tunning) which mount/unmount these paritions just before bootmisc is starting:

#!/sbin/runscript

description="Optimize var/tmp/usr folders for SSD usage"

depend()
{
	need modules
	before bootmisc
}

start() {
    ebegin "Optimizing folders for SSD usage"
    # wait about 2 seconds until udev synchronize /dev, otherwise we'll not be able to mount the devices listed below
    sleep 2
    mount /dev/sdb5 /var > /dev/null
    mount /dev/sdb6 /tmp > /dev/null
    eend $? "An error occured while attempting to optimize folders for SSD usage"
}

stop() {
    ebegin "Removing optimizations for SSD usage"
    umount -f /dev/sdb5 > /dev/null
    umount -f /dev/sdb6 > /dev/null
    eend $? "An error occured while attempting to remove SSD usage optimizations"
}

Note: To start it at boot time run the following command at prompt:

rc-update add ssd-tunning boot

Valuable information related to SSD setup, benchmark, performance:

  • SSD on Gentoo could be found also here
  • how SSD works could be found also here and here
  • It worth also to read more about partition alignment which might boost disk throughput performance. Interesting thread could be found here
  • If you are interested in getting info about some SSD benchmark or comparing two SSD performance then it worth taking a look at the AnandTech benchmark webpage
  • SSD performance test comparison as of summer of 2011 (om du kan svenska)
  • Ted Tso blog post about SSD can be found here
  • precious information about aligning an SSD on Linux can be found here

Update:

About my Corsair Force 3 SSD performance on my SATA II interface (I don't have SATA III controller) :

gentoo before and after ssd

Conclusion: Gentoo before and after ssd => the boot-time was reduced with 66%

Update as of 2015-03-08 (ref. Portage TMPDIR on tmpfs):

For system's containing SSDs, it is generally a good idea to have Portage compile using tmpfs (RAM) instead burning up precious SSD write cycles (especially on something like compiling software).

Read more here.

 

Now, if you think that this article was interesting don't forget to rate it. It shows me that you care and thus I will continue write about these things.

The following two tabs change content below.
Gentoo before and after SSD

Eugen Mihailescu

Founder/programmer/one-man-show at Cubique Software
Always looking to learn more about *nix world, about the fundamental concepts of math, physics, electronics. I am also passionate about programming, database and systems administration. 16+ yrs experience in software development, designing enterprise systems, IT support and troubleshooting.
Gentoo before and after SSD

Latest posts by Eugen Mihailescu (see all)

Tagged on: , , , ,

One thought on “Gentoo before and after SSD

Leave a Reply

Your email address will not be published. Required fields are marked *