How to upgrade your Linux box for Steam

Lifespan

Two common concerns that people have about SSDs is how long they last, and whether the performance you get when they're new will last all the way to old age. These concerns aren't unfounded.

The transistors in an SSD will last only for about 10 years, or 10,000 writes, whichever comes first - so they have a limited life. What's more, in some early models, badly designed firmware meant that performance could degrade significantly over time.

In modern drives, with a modern operating system and file-system, the significance of these problems has been reduced massively thanks to something called TRIM. This helps the drive's firmware to manage the allocation of blocks of data, ensuring that each transistor is written to the minimum number of times without degrading performance.

How big an impact does TRIM have? In one of the most authoritative articles on the subject, Anand Lal Shimpi found that on an aged drive, write performance was just 52% that of a clean drive without TRIM; with TRIM, the aged drive performed at 98% that of the clean one. TRIM is worth enabling.

So, how do you get TRIM working? The first thing to do is make sure that your drive supports it. If it has been bought in the last few years, it almost certainly will, but anything older and you'll need to check if it's supported. You can do this with the hdparm command, as follows:

hdparm -I /dev/ | grep "TRIM supported"

replacing with the device name of your SSD.

If that command returns something, then you're ready to enable TRIM in the operating system. To do this, you need to format your partitions with the ext4 or btrfs filesystems. These are the only two that support TRIM.

Here at LXF towers, we use ext4, since btrfs is still lacking a stable repair tool, making it less able to recover from disaster - we recommend that you do, too.

Modify the mount options

After that, you will need to modify the mount options of the file-systems, as they don't enable TRIM support by default. This can be done by editing the /etc/fstab file.

Before making any modifications to the file, however, make sure you create a backup, as if you get things wrong in this file, it can stop you from booting.

cp /etc/fstab /etc/fstab.bk

If anything goes wrong now, you can boot in to a live CD, reverse the copy, reboot and your system will be working again.

With the backup in place, you need to modify, on each line that describes a partition on your SSD, the part that has the word 'defaults' in it. To this, you want to add ',discard', so that the entire line looks something like:

/dev/sda1 / ext4 defaults,discard 0 1

That's it. Save the file, reboot, and your drive has TRIM support enabled. This is the most important tweak to apply to your SSD.

Extending life

There are other ways to tweak your drive and extend its life still further. The easiest of these other techniques is to add the noatime option to your mount options, just like we did with discard above.

Normally, Linux file-systems store the last time a file was read from, and the last time it was modified. With the noatime option, it will store only the last time it was modified, reducing the number of writes in order to keep this metadata up to date and increasing the life of your drive.

A word of warning, however: older applications, such as Mutt, won't function properly if you enable noatime, so first check application compatibility.

You can also increase the life of your drive by thinking carefully about what partitions you put on it. For instance, if you have a traditional hard drive available on your system as well, you might consider using the SSD for filesystems that don't change frequently, such as / and /home, while putting things such as /var, /tmp and swap on the spinning disk.