Skip to content
Go back

Is Your Linux Server Destroying Its SSD?

By SumGuy 5 min read
Is Your Linux Server Destroying Its SSD?

SSDs have a limited lifespan measured in write cycles. Every time you write data, you’re using up a tiny bit of the drive. Write enough times, and the drive dies. Most drives are rated for millions of cycles — plenty for normal use — but a badly configured server can murder an SSD in years, not decades.

Here’s the thing: on a Linux server, writes you don’t even think about can add up fast. Logs. Journald. Temporary files. If you’re not careful, your drive is getting hammered every second.

Check Your SSD Health

First, find out if your drive is suffering:

Terminal window
$ sudo apt install smartmontools
$ sudo smartctl -a /dev/sda

Look for these lines:

Terminal window
Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 12 (Min/Max 0/12)
Power-On_Hours 0x0032 100 100 000 Old_age Always - 4321 (Min/Max 0/5000)
Media_Wearout_Indicator 0x0024 091 091 010 Old_age Always FAILING 91
Percent_Lifetime_Remain 0x0024 091 091 010 Old_age Always - 91%

The Media_Wearout_Indicator (or Percent_Lifetime_Remain) tells you how much life is left. If it’s below 50, your drive is aging faster than expected. If it’s below 10, replace it soon.

The Culprit: File Access Time

By default, Linux updates the “access time” (atime) every time a file is read. This means:

  1. You read a log file with cat
  2. Linux updates the file’s metadata (atime)
  3. That’s a write to the filesystem
  4. On an SSD, every write counts

If your server reads thousands of files per day (and it does), your SSD is taking a write hit for no benefit. The atime is rarely used by anything.

Terminal window
$ stat /var/log/syslog
Access: 2025-04-23 10:45:12.123456789 -0700
Modify: 2025-04-23 10:44:50.987654321 -0700
Change: 2025-04-23 10:44:50.987654321 -0700

That Access time? It gets updated every read. Disable it.

Fix 1: Mount with noatime

Edit /etc/fstab:

/etc/fstab
# Before
UUID=12345 /home ext4 defaults 0 0
# After
UUID=12345 /home ext4 defaults,noatime 0 0

noatime disables atime updates. More aggressive is nodiratime, which disables atime for directories too. Or use relatime (only updates atime if it’s older than the modify time — reasonable compromise).

Remount to apply:

Terminal window
$ sudo mount -o remount,noatime /
$ sudo mount -o remount,noatime /home
$ sudo mount -o remount,noatime /var

Verify:

Terminal window
$ mount | grep noatime
/dev/sda1 on / type ext4 (rw,noatime)

Done. That alone can cut write traffic significantly.

Fix 2: Move Logs to tmpfs (RAM)

Logs write constantly. On a typical server, that’s hundreds of writes per second to disk. Move them to RAM instead.

Create a tmpfs mount:

Terminal window
$ sudo mount -t tmpfs tmpfs /var/log -o size=2G

Make it permanent in /etc/fstab:

/etc/fstab
tmpfs /var/log tmpfs defaults,size=2G 0 0

Now /var/log lives in RAM. Writes are instant. The data goes away on reboot (that’s the point — logs are temporary anyway).

But wait: You lose logs on reboot. If you need retention, use systemd’s journal to centralize logs before they’re lost:

/etc/systemd/journald.conf
[Journal]
Storage=persistent
MaxRetentionSec=30days
MaxFileSec=1d
SystemMaxFileSize=100M

This writes journal entries to /var/log/journal for 30 days, but individual rotated logs are much smaller and less frequent.

Fix 3: Reduce Journald Write Frequency

systemd’s journald logs everything. By default, it syncs to disk frequently. Reduce that:

/etc/systemd/journald.conf
[Journal]
Compress=yes
ForwardToSyslog=no
SystemMaxUse=100M
RuntimeMaxUse=50M
SyncIntervalSec=5m

Reload:

Terminal window
$ sudo systemctl restart systemd-journald

Fix 4: Check What’s Actually Writing

See which processes are writing most:

Terminal window
$ sudo iostat -x 1 5
Device r/s w/s rMB/s wMB/s
sda 12 456 1.2 23.4

If w/s (writes per second) is high, investigate:

Terminal window
$ sudo iotop -o
TID PRIO USER DISK READ DISK WRITE SWAPIN IO>
2341 be/4 root 0.0 B/s 5.2 M/s 0.0 % syslog
5678 be/4 user 0.0 B/s 2.1 M/s 0.0 % app.log

Something’s writing 5+ MB/sec. Is it necessary? Can it be moved to tmpfs? Can it be disabled?

Fix 5: Disable Unnecessary Logging

Some services are chatty. Reduce their log level if you don’t need the noise:

Terminal window
# Check nginx access logs
$ tail -f /var/log/nginx/access.log
# Hundreds of lines per second
# Disable access log (or move to buffer)

Most services have config options to:

Real Numbers

On a typical web server:

That’s a 20x reduction in write traffic. For an SSD rated for 1000 PBW (petabytes written), the difference is years of lifespan.

The Checklist

To protect your SSDs:

Terminal window
# 1. Check drive health
sudo smartctl -a /dev/sda
# 2. Add noatime to /etc/fstab
# 3. Move logs to tmpfs (optional)
# 4. Tune journald.conf
# 5. Check write rates with iostat
# 6. Identify and silence chatty services

Key Takeaway

SSDs are tough, but they’re not immortal. Every unnecessary write counts. Disabling atime and moving logs to RAM are the easiest wins. In production, a few simple config changes can double or triple SSD lifespan.

Future you will appreciate the extra years of service.


Share this post on:

Send a Webmention

Written about this post on your own site? Send a webmention and it may appear here.


Previous Post
SSH Agent Forwarding: How It Works
Next Post
Docker Compose Profiles: Run Only What You Need

Related Posts