Pinterest Stumbleupon Whatsapp
Advertisement

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 PowerTOP Will Maximize Your Linux Laptop's Battery Life PowerTOP Will Maximize Your Linux Laptop's Battery Life On Linux laptops, one of the most common complaints is that the battery life isn't that great. You can find out what settings are best for your system using PowerTOP. Read More 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 Should You Get A Solid State Drive (SSD)? [Opinion] Should You Get A Solid State Drive (SSD)? [Opinion] If you've kept up with some of the latest news about new computer parts, you may have heard about SSDs, or solid state drives. They are designed to replace your clunky, slow hard drive and... Read More .

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).

Advertisement

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 What Is a Linux SWAP Partition, And What Does It Do? What Is a Linux SWAP Partition, And What Does It Do? Most Linux installations recommend that you include a SWAP partition. This may seem odd to Windows users – what is this partition for? Read More 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

Leave a Reply

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