Increase Performance and lifespan of SSDs & SD Cards

SSDs (solid-state drives) and SD (Secure Digital) cards have a limited number of writes before they wear out. To get the most out of this storage type, let’s investigate, then make a few adjustments to maximize the life of your SSDs and SD cards. This article has been refreshed from 6 years ago.


Using iotop to monitor and minimize reads/writes

Use your Linux distro’s package manager to install iotop, a top-like utility for disk I/O. It monitors disk I/O usage information output by the Linux kernel and displays a table of current usage by processes on the system. Use iotop with the following options:

iotop -oPa

Then let iotop monitor things for a few mins or hours depending on how intense disk I/O is. This will result in a top-like screen, making it easy to identify processes hogging your disk I/O. Have a look at the screenshot below as an example.


See MySQL tuning and PHP performance tips. You cannot eliminate all disk I/O, especially for services like MySQL and PHP (pictured above). What you are looking for are processes hogging disk I/O without good reason. Below are additional tips for avoiding some common disk overhead.


noatime Mount Flag

Using the noatime mount flag in the /etc/fstab file stops the logging of read access times to the file system. The noatime mount flag eliminates the need for the system to make timestamp writes for files being read. Since writes are more expensive, this often results in measurable performance gains.

Here’s what this line should look like in /etc/fstab:

/dev/sdx / ext4 discard,noatime,errors=remount-ro 0 1


Mount temporary directories as tmpfs

If your system has enough memory, you can mount some temporary directories as a tmpfs. This reduces unnecessary writes to the SSD. Again edit /etc/fstab:

# SSD tweak: temporary directories as tmpfs
tmpfs   /tmp       tmpfs   defaults,noatime,mode=1777   0 0
tmpfs   /var/tmp   tmpfs   defaults,noatime,mode=1777   0 0


Avoid heavy use of Swap Space

This is a recommended tweak for SSDs and SD cards on systems using a swap partition. This will reduce the “swappiness” of your system, thus reducing disk swap I/O. On Debian/Ubuntu (or Red Hat/CentOS), add or modify the following in /etc/sysctl.conf (or the equivalent config file).

# Decrease swap usage

If you have adequate free memory and understand the risks, you can avoid adding swap altogether or use this instead.
Also, read Linux Performance: Why You Should Almost Always Add Swap Space, and Does your Linux server need a RAM upgrade?


You can also automate swap only to be enabled when necessary using systemd-swap.
Also, see zram-generator or zram-swap.


Reduce logging writes

Disable access logs for Apache, Nginx, mail server, and other services you have installed. Once your system is stable, you can reduce system log levels from info to warn or even error OR, if you don’t mind losing log files between boots, move them to tmpfs by editing /etc/fstab:

tmpfs /var/log tmpfs defaults,noatime,mode=0755 0 0

For journalctl, you can tweak this in /etc/systemd/journald.conf.

Edit the following lines accordingly (read descriptions and size format):



Mount even more directories with heavy I/O to tmpfs

For example, mount the WordPress cache directory from disk to tmpfs:

tmpfs /full/path/to/wp-content/cache tmpfs defaults, size=1G 0 0


profile-sync-daemon (for desktop only)

If you’re not optimizing a web server and use Firefox, Chrome, etc., install the profile-sync-daemon. The Profile-sync-daemon (PSD) is a tiny pseudo-daemon designed to manage your browser’s profile in tmpfs and periodically sync it back to your physical disc (HDD/SSD).


I/O Scheduler

Consider switching from the CFQ to NOOP or Deadline. Both offer better performance on SSDs and SD cards.

Check which scheduler you are using with the following command (replace sdX):

cat /sys/block/sdX/queue/scheduler

Change the scheduler by adding the kernel parameter “elevator=noop.” (Red Hat/CentOSDebian/Ubuntu)



If not already enabled by default. TRIM allows Linux to inform the SSD which blocks of data are no longer considered in use. Therefore, when you delete a file, your SSD can write data to blocks without performing the cumbersome deletion process. In essence, TRIM ensures that your SSD’s performance doesn’t degrade too much with use.

First, check your /etc/fstab file to confirm that you have the discard option set for your SSD.

To check if your SSD or SD card supports TRIM, use the following:

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

To check if TRIM is enabled, use the following:

sudo systemctl status fstrim.timer

The result will look like this if enabled:

● fstrim.timer - Discard unused blocks once a week
     Loaded: loaded (/usr/lib/systemd/system/fstrim.timer; enabled; vendor preset: disabled)
     Active: active (waiting) since Wed 2021-05-12 14:52:42 AST; 58s ago
    Trigger: Mon 2021-05-17 00:35:19 AST; 4 days left
   Triggers: ● fstrim.service
       Docs: man:fstrim

May 12 14:52:42 alien systemd[1]: Started Discard unused blocks once a week.

To enable use:

sudo systemctl enable fstrim.timer
sudo systemctl start fstrim.timer


Further increasing performance/life of SSDs & SD Cards

Use larger SD cards. – Writes are spread based on the storage size, so the larger the storage, the less it will repeatedly rewrite over the same areas = less wear.
You get what you pay for – Cheap SSDs and SD cards usually will not last as long or perform as fast.
Use this command to check for issues and lifespan:

sudo smartctl -a /dev/sdxx


Published: Jan 30th, 2018 | Last updated: June 26th, 2023

Tags: , ,


  1. I have always wonder what options there were for keeping SSDs alive longer. I have fears of losing my files so I am always moving them to a new SSD every 2 years. What is considered the average lifespan of an SSD that has files on it but is not being used?

  2. Good question. SSDs have come a long way since originally publishing this article.

    The lifespan is not absolute. But modern and good quality SSDs will work well for 10+ years.
    And sitting unused for at least 10 to 15 years. Maybe longer but that’s risky.

    Of course, there are variables such as climate (temperature, humidity, salt air, etc), load/usage, brand/quality, etc. etc.

    I’ve been using a pair Samsung EVO SSDs in RAID 0, for the past 8 years without a single issue:

  3. Love this. I am using more and more SSDs it seems just to keep all my files safe and organized. I have one for just about everything - gaming, movies, music, series, etc.

    In the age of digital consumption, we need to make sure the lifespan and performance stays topnotch! Going to give these tips a try in the near future.

  4. How common is it for an SSD to die due to a power outage?

    I had been considering getting a UPS for this very reason because I am paranoid that the power might kill my SSDs if the power goes. I have at least 3 or 4 per year where I live and it almost always happens when I have my computer running.

  5. Does disabling hibernation make a difference?

    I remember someone telling me this a year or two back on another forum. Saying disabling actually benefits the SSD overall but I never actually did it.

Top ↑