Home Wiki > SDB:SSD performance
Sign up | Login

SDB:SSD performance

tagline: From openSUSE

Tested on openSUSE Recommended articles Related articles
Icon-checked.png

Icon-manual.png Icon-help.png


This article explains how to optimize openSUSE for an SSD.

Contents

[edit] Situation

Your brand new computer has an SSD drive. You might not want to wear it out too soon and you'd like to profit as much as you can from its performance. So, what file system should you use? Anything else? You'll find it here.


[edit] Maximize performance & durability

This article describes several choices you have to make:

[edit] Intel SSD

There is a bug in old Intel SSD firmware, that will cause stalls when the smartd daemon is running, which is enabled by default. To solve it, upgrade your drive's firmware from [1]

[edit] Filesystems

The file systems which work best with SSD drives are BTRFS and EXT4. However, BTRFS is still experimental, so Ext4 is the safest choice.

However if you intend to run Tumbleweed the kernels newer than the default in openSUSE 11.4 will most likely start to offer better performance on BTRFS than Ext4 while this file system matures.

In this article we assume /dev/sda is your SSD.

[edit] create TMPFS filesystems

It is highly recommended to put the most volatile parts of your data on a TMPFS - this especially includes the /tmp directory. This directory only contains temporary files which are deleted upon reboot. Having this in memory is an excellent way to save your SSD some work. Note that if you keep your system running for a long time, the size of this directory (hence its memory usage) can balloon quite a bit. It is recommended to log out of your DE, remove the content, and log in again if you're experiencing memory pressure.

Mount /tmp in a tmpfs filesystem:

# mkdir -p /etc/systemd/system/local-fs.target.wants
# ln -s /usr/lib/systemd/system/tmp.mount /etc/systemd/system/local-fs.target.wants/tmp.mount

This will create the /tmp folder in memory on a fresh boot.

On openSUSE 12.2 the procedure should be a bit different:

Start by creating directory(ies) for custom configuration, e.g.

# mkdir -p /etc/systemd/system/local-fs.target.wants

as above.
Create unit file for systemd (using vi or your preferred editor):

# vi /etc/systemd/system/tmp.mount

and copy-paste this text (to paste in vi: i followed by Shift-Ins), then save (in vi: :wq)

#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.

[Unit]
Description=Temporary Directory
Documentation=man:hier(7)
Before=local-fs.target

[Mount]
What=tmpfs
Where=/tmp
Type=tmpfs
Options=mode=1777,strictatime

Finally create the symlink, similarly like above:

# ln -s /etc/systemd/system/tmp.mount /etc/systemd/system/local-fs.target.wants/

A second change you should do in fstab is make sure that your SSD has the noatime option:

/dev/sda1    /  ext4   noatime,defaults  0       1

noatime might break some backup tools; using

relatime

could solve that.

[edit] Other changes

Some other changes you can do

[edit] boot.local

It is recommended to put the following lines in your /etc/rc.d/boot.local file. The commands will be executed upon boot. Every second line describes the function of the first one.

hdparm -W1a0A0 /dev/sda
# drive caching on, readahead off

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

You could also use deadline instead of noop but reading the tread here it seems noop is the best choice as deadline can easily give up to 10 sec stalls.

echo 1 > /sys/block/sda/queue/iosched/fifo_batch
# enable fifo_batch for the scheduler

echo 500 > /proc/sys/vm/dirty_writeback_centisecs
echo 20 > /proc/sys/vm/dirty_ratio
echo 5 > /proc/sys/vm/dirty_background_ratio
# the 3 options above make your computer write back data to the SSD sooner rather than later

[edit] readahead

You should disable readahead as it is quite useless on SSD's with their minimal seek times. You can do this if you have the pm-utils installed in their configuration directory:

# systemctl disable systemd-readahead-collect.service
# systemctl disable systemd-readahead-replay.service

And done.

[edit] Even more

Flash memory is managed in blocks, larger that the 512 byte units that partitions are measured in. With default linux tools, you'll surely align the filesystem in such a way that it generates unnecessary IO because every time you write data it touches two instead of one block. You can solve this by aligning the partitions and the filesystems on them to larger blocks than 512 bytes and making sure the start at 0.

However it is quite a procedure and you'll only do it on a new SSD. In the links below you can find information on how to do it:

[edit] See also

[edit] Related articles

[edit] External links