How To Optimize Linux For SSDs

Ads by Google

Get the most out of your SSD in Linux – here’s what you need to know.

Linux is pretty great out-of-the-box, there are still some items that require a little bit of manual optimization to get them going as smoothly as possible. Controlling power consumption is the most common one, but optimizing your system for SSDs is another important one. And it’s important to do so, because well-maintained SSDs are a joy to have.

To get the best performance and least wear-and-tear on your solid state drive, try these optimizations for your Linux system.

Update Your Distribution

While I don’t think this will be an issue for most people, it’s still worth mentioning. In order to take advantage of the latest optimizations in applications, kernel, filesystem, and much more, it’s best to run the latest version of your favorite distribution. If even if you’re on older but still-supported releases (such as Ubuntu 12.04), it’s best to upgrade to the latest version (such as 14.04) as there have been a ton of changes that make the operating system much more SSD-friendly.

Update SSD Firmware

It’s also a good idea to upgrade the firmware on your SSD. The instructions on how to do this is different for each vendor, so you’ll need to look up instructions for your specific SSD. Be aware that some (but not all) don’t allow the firmware to be updated via Linux; instead, you’ll need to use a specific bootable environment (similar to a Linux live environment) or a Windows utility to do the job.

Use ext4

linux_ssd_ext4
When you’re freshly installing a Linux system, it’s best to use the ext4 filesystem. It’s the most used, and most stable, filesystem available that supports TRIM (which still needs to be enabled – more on that below).

Ads by Google

This shouldn’t be much of a problem: most distributions default to ext4.

Mount Options At Boot

linux_ssd_fstab
Every time you boot your Linux system, it must mount the various drives in your computer in order to use them. There are various mount options you can use, depending on your hardware and your needs, and some are appropriate to use with SSDs.

To make these changes, open up your terminal and run the command sudo nano /etc/fstab. Next, find the partition(s) in your SSD(s) that are listed in this file. Partitions here are normally listed by UUID, which is more precise than the /dev/sdXY identification system. If you have multiple partitions, you can use the command blkid /dev/sdXY to find the UUID, replacing X with a-z and Y with 1-9.

Then, add the following mount options: discard and noatime. Discard allows the SSD’s TRIM function to be used – this improves performance and longevity. The other option, noatime, tells the filesystem to not keep track of last accessed times – just last modified times. This can reduce wear and tear on your SSD, because there are many files that you access while you use your computer but there are far fewer files that you’ll end up modifying. The file should look similar to the screenshot above.

If you find that some programs are misbehaving with the noatime option (as last accessed times will be before last modified times, which is normally impossible), you can replace noatime with relatime. This updates the last accessed time with the same value as the last modified time, all in the same write operation.

Don’t Use SWAP

linux_ssd_noswap
When using an SSD, it’s also a very good idea to not have a SWAP partition on it (unless you have a serious reason to do so).

The constant reads and writes SWAP partitions do add significant wear-and-tear to the SSD. If you really would like to have a SWAP partition, it’d be better to place it on a secondary, non-SSD hard drive if at all possible. I know it’s tempting to put a SWAP partition on an SSD – it would be the best-performing SWAP partition you’ll ever have – but this speed comes at a major cost.

A lot of people suggest that you can still add a SWAP partition but disable hibernation, since that causes extreme amounts of reads and writes. But since it’s rare that you’ll use a SWAP partition, as you probably have more than enough RAM, it’ll just take up space and potentially cause wear-and-tear. Also, not including a SWAP partition to begin with is an easy way to disable hibernation

Conclusion

These tips should get you well on your way to a much more optimized SSD experience on Linux. And your SSD will thank you by lasting a few years longer than it would without these optimizations. If you feel lucky, you can research even more SSD-related optimizations that may not be for the faint of heart. It’s up to you, but these tips do the most amount of good for your SSD. Most other tweaks are only nitpicks that provide a minimal difference.

What SSD optimizations can you recommend? What’s your opinion on how SWAP should be handled? Let us know in the comments!

Image Credits: Robert Via Flickr

Join live MakeUseOf Groups on Grouvi App Join live Groups on Grouvi
Computer Hardware Talk
Computer Hardware Talk
423 Members
Linux Terminal Master
Linux Terminal Master
392 Members
Linux for Beginners
Linux for Beginners
289 Members
Best Linux Apps
Best Linux Apps
262 Members
Linux Distros Talk
Linux Distros Talk
126 Members
Affiliate Disclamer

This article may contain affiliate links, which pays us a small compensation if you do decide to make a purchase based on our recommendation. Our judgement is in no way biased, and our recommendations are always based on the merits of the items.

For more details, please read our disclosure.
New comment

Please login to avoid entering captcha

Log In