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

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

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

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


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
Master the Linux Command Line
Master the Linux Command Line
38 Members
Best Linux Apps
Best Linux Apps
35 Members
Linux for New Switchers
Linux for New Switchers
34 Members
Linux Distros Talk
Linux Distros Talk
29 Members
Ads by Google
Comments (19)
  • David

    There are a number of bad ideas in this article, based on common myths and misunderstandings.

    First, never use the “discard” option. Online TRIM is a bad idea. This is not because the Linux kernel’s implementation is poor – it is that the specifications of the TRIM disk command are idiotic. I don’t want to go into details here – look them up if you want. But the result is that “discard” makes metadata operations far slower. It is much better to do an offline “fstrim” on occasion (I believe many distros will do that by default) – or if you have a reasonably modern SSD that is fairly good quality, just ignore TRIM altogether and let the SSD’s garbage collection and overprovisioning handle everything.

    You will /never/ wear out your SSD – modern devices can be written to continuously for years without wearing out. So put /var, swap, etc., on the SSD without worrying.

    The most efficient choice for /tmp is tmpfs. If you want to store a lot of files in /tmp, keep it tmpfs and make sure you have plenty of swap. It is faster (and less wear on your SSD) to have files in tmpfs spilled out into swap than putting them on a normal filesystem.

    ext4 is a good filesystem, but not because of “discard”. btrfs is also a solid choice these days for people looking for more features.

  • Johnnie

    @ Eddie
    The intention of this article is not to optimize an SSD for performance but rather lifespan of the drive. Even some of the slowest SSDs can out perform a standard HDD.

  • kayla

    If your MLM has been running you ragged, consider the video aspect of it. You can use Modulates or another site to ramp up your video.

  • Eddie G. O’Connor Jr.

    The whole point of SSD drives was the “no mechanical parts” thus the wear & tear the industry speaks of is strictly in reads/writes and the amount of and speed of reads and writes a SSD can have will always be larger than any spinning drive. SO at this point in time trying to “optimize” it is almost a wasted effort, granted there might be a time in the future where an SSD which has been in service for quite some time might need optimizing to squeeze just a little more life out of it, but these things are so robust that it probably won’t be in our lifetimes…..I’m just sayin’ LoL!

  • Donald Dogshit

    No, but it’s not uncommon to find 8GB memory in many current laptops, and up to 16GB in some. I’d argue that at 8GB it’s questionable whether or not /swap is really necessary. At 16GB, it’s not. A careful; “what will I use this to do?” thought exercise would help determine if eliminating the swap partition is a good idea or not. If the user intends to do a shedload of Photoshop or CAD *shudder* then…errr…even at the cost of the sacrifice of some SSD life…deploy /swap.

    Lastly, It’s only fair to include the view that IF there’s a serious amount of memory, then /swap will only rarely be used, & only in weird circumstances. Deploy /swap *anyway* as a matter of good practice. Honestly, what bothers me a little more than /swap is /var/log and here’s why; it *does* get used – a lot, and the writes are TINY – exactly what’s bad for SSD’s.

    IF the laptop design accommodates using the DVD drive bay as an extra H/D bay, then the purist solution would be to locate /var & /swap on spinning rust thus rendering this part of the SSD discussion moot.

    Lastly, and concerning laptops, I quote a colleague of mine, who – after reading this article and the comment thread – tartly observed; “So what? at the speed SSD prices are dropping, the reduction is lifespan resulting from long term heavy use of /swap and /var/log, if the SSD dies prematurely, replace it with no more regret (or hit on the wallet) than you would a spinning H/D. If you’re *that* concerned, then invest in an enterprise class SSD, many of which will write PB’s of data for years before using up all writeable blocks.” Another colleague, leaning towards the same side of the argument, remarked that even consumer-grade SSD’s with decent ratings/specs will – under “normal” usage – last for the lifetime of the laptop itself.

    So yeah, here’s a fairly decent range of views from the purist to the pragmatist. I trust that the above contributes to the discussion.

    • dragonmouth

      It is very edifying that you have such rich and profligate colleagues. However, not everyone is so blessed. I can get a 1TB HD for around $50. A similar sized SSD runs between $350-$400. I am sure there are a lot of people out there that do not want to be regularly replacing SSDs at those prices.

Load 10 more
Affiliate Disclamer

This review 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.
Affiliate Disclamer

This review 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.