Increase the Performance and lifespan of SSDs & SD Cards

Read the full article: Increase the 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. Table of… continue reading.
4 Likes

What is considered the average lifespan of an SSD that has files on it but is not being used?

2 Likes

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:

2 Likes

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.

1 Like

Generally, your concern here is with the filesystem on the SSD, not with the SSD itself. Most modern filesystems can tolerate hard power losses but it’s likely that you will lose at least some data in the process (could be ephemeral data, could be “real” files). If you’re having 3-4 power failures per year, it’s probably a good idea to get that UPS; can’t hurt. If possible, it might be a good idea as well to set your OS up to recognize the power outage and gracefully come down within the UPS’s hold time.

2 Likes

This article has been updated. A lot has changed since 2018, so I’ve added notes for 2025+.

1 Like

With 8GB RAM on my Raspberry Pi 5, I’m booting from a 128GB SanDisk Extreme Pro micro-SD, for best performance (without using a HAT).

I’d like to know that the SD card isn’t being hit for swapping, given that I barely use half the RAM most of the time. There’s no vm.swappiness setting in my /etc/sysctl.conf file (or related .conf files).

Would I be able to detect any such occurrences with iotop? In accumulated output, I do see a root process making writes: [jbd2/mmcblk0p2-8]

1 Like

iotop can help you spot I/O activity, but what you’re seeing with the jbd2 process is normal journaling for ext4—not necessarily swap activity.

To be sure swap isn’t creeping in, try monitoring with vmstat for overall swap usage with:
vmstat -s | grep -i swap

To get, say, five samples at one-second intervals:
vmstat 1 5

…or by checking /proc/vmstat for any nonzero swap-in or swap-out counters, try:
cat /proc/vmstat

or look for the pswpin and pswpout fields:
grep -E 'pswpin|pswpout' /proc/vmstat

or watch over time with:
watch -n 1 "grep -E 'pswpin|pswpout' /proc/vmstat"

If those counters remain at zero over time, your system isn’t swapping. If you want to disable swap entirely, you can do so with these steps:

Temporarily disable swap:
Run sudo swapoff -a to turn off all swap immediately.

Prevent swap from re-enabling on boot:

  • If your system uses a swap file via dphys-swapfile (common on Raspberry Pi OS), edit /etc/dphys-swapfile and set:
CONF_SWAPSIZE=0
  • Then stop and disable the service:
sudo systemctl stop dphys-swapfile
sudo systemctl disable dphys-swapfile

Oh, also, check /etc/fstab for any swap entries and comment them out if present.