Gentoo before and after SSD


Please note that this blog has been moved.

Now it has its own domain: mynixworld.info🙂

If you want to read the latest version of this article (recommended) please click here and I open the page for you.

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:

bootchart-HDD

click to zoom

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

bootchart-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 below
sleep 2
mount /dev/sdb1 /var > /dev/null
mount /dev/sdb2 /tmp > /dev/null
mount /dev/sdb3 /usr/portage > /dev/null
eend $? "An error occured while attempting to optimize folders for SSD usage"
}

stop() {
ebegin "Removing optimizations for SSD usage"
umount -f /dev/sdb1 > /dev/null
umount -f /dev/sdb2 > /dev/null
umount -f /dev/sdb3 > /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) :

Corsair3SSD-Benchmark

About Eugen Mihailescu

Always looking to learn more about *nix world, about the fundamental concepts of arithmetic, algebra and geometry. I am also passionate about programming, database and systems administration.
This entry was posted in linux and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s