Increase the performance and lifespan of SSD and SD cards

SSD (Solid-State Drive) and SD (Secure Digital) cards have a limited number of writes before they go bad. To get the most out of this storage type, let’s examine, then, make some adjustments to maximize the life of your SSD and SD card. Article refreshed from 6 years ago.

Using iotop to monitor and minimize read/write

Use your Linux distro’s package manager to install isotope, an apex-like utility for disk I/O. It monitors the 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 minutes or even hours depending on how fast the disk I/O is. This will result in a top-like screen that makes it easy to identify the processes hogging your disk I/O. For example, see the screenshot below.

See MySQL Tuning And PHP performance advice. You can’t eliminate all disk I/O, especially for services like MySQL and PHP (pictured above). What you’re looking for are processes hogging disk I/O for no good reason. Below are additional tips for avoiding some of the common disk overhead.

noatime mount flag

using the noatime at the flag hoisting /etc/fstab The file prevents the logging of read access times to the file system. The notime mount flag eliminates the need to write timestamps to files the system reads. Since writes tend to be more expensive, this often results in measurable performance gains.

Here’s what this line should look like /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 minimizes unnecessary writes to the SSD. edit again /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 SSD and SD cards on systems that use swap partitions. This will reduce the “swapness” of your system, thus reducing disk swap I/O. On Debian/Ubuntu (or Red Hat/CentOS), add or modify the following /etc/sysctl.conf (or equivalent configuration file).

# Decrease swap usage

If you have enough free memory and understand the risks, you can avoid adding swap altogether or use it 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 automatic swap Can be enabled only when absolutely necessary systemd-swap,
See more xram-generator either xram-swap,

reduce logging writes

Disable access logs for Apache, Nginx, mail servers, and other services you have installed. Once your system is stable, you can reduce the system log level informationTo warn or even Error or mef 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 JournalCTLyou can tweak it /etc/systemd/journald.conf,

edit According to the following lines (read Description and Size Format,


Mount even more directories from heavy I/O to tmpfs

For example, Mount TThat 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 are not customizing web server and use firefox, chrome etc., install profile-sync-daemon, profile-sync-daemon (PSD) is a small pseudo-daemon designed to manage your browser’s profile in tmpfs and periodically sync it back to your physical disk (HDD/SSD).

I/O Scheduler

Consider switching from CFQ to NOOP or time frame. Provides better performance on both SSD and SD card.

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 “lift=nope”. ,red hat/centos, Debian/Ubuntu,


If not already enabled by default. TRIM allows Linux to inform the SSD which blocks of data are no longer in use. Therefore, when you delete a file, your SSD can now write data in blocks without having to perform the cumbersome deletion process. In short, TRIM makes sure that the performance of your SSD doesn’t degrade too much with usage.

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

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

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

To check if TRIM is enabled, use:

sudo systemctl status fstrim.timer

When enabled the result will look like this:

● 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 the performance/life of SSD and SD card

, Use bigger SD card. – Writes are spread based on the size of the storage, so the larger the storage, the less frequently the same sectors will be rewritten = less wear.
, you get what you pay for – cheap ssd and sd card In general Won’t last as long or perform as fast.
, use this command To check issues and lifetime:

sudo smartctl -a /dev/sdxx

Published: January 30, 2018 | Last Updated: May 12, 2021

Leave a Comment