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:
$ sudo apt install smartmontools$ sudo smartctl -a /dev/sdaLook for these lines:
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 91Percent_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:
- You read a log file with
cat - Linux updates the file’s metadata (atime)
- That’s a write to the filesystem
- 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.
$ stat /var/log/syslogAccess: 2025-04-23 10:45:12.123456789 -0700Modify: 2025-04-23 10:44:50.987654321 -0700Change: 2025-04-23 10:44:50.987654321 -0700That Access time? It gets updated every read. Disable it.
Fix 1: Mount with noatime
Edit /etc/fstab:
# BeforeUUID=12345 /home ext4 defaults 0 0
# AfterUUID=12345 /home ext4 defaults,noatime 0 0noatime 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:
$ sudo mount -o remount,noatime /$ sudo mount -o remount,noatime /home$ sudo mount -o remount,noatime /varVerify:
$ 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:
$ sudo mount -t tmpfs tmpfs /var/log -o size=2GMake it permanent in /etc/fstab:
tmpfs /var/log tmpfs defaults,size=2G 0 0Now /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:
[Journal]Storage=persistentMaxRetentionSec=30daysMaxFileSec=1dSystemMaxFileSize=100MThis 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:
[Journal]Compress=yesForwardToSyslog=noSystemMaxUse=100MRuntimeMaxUse=50MSyncIntervalSec=5mCompress=yes— Compress old journalsSyncIntervalSec=5m— Flush to disk every 5 minutes instead of after each logSystemMaxUse=100M— Cap persistent journal sizeRuntimeMaxUse=50M— Cap runtime journal (in RAM) size
Reload:
$ sudo systemctl restart systemd-journaldFix 4: Check What’s Actually Writing
See which processes are writing most:
$ sudo iostat -x 1 5Device r/s w/s rMB/s wMB/ssda 12 456 1.2 23.4If w/s (writes per second) is high, investigate:
$ sudo iotop -oTID PRIO USER DISK READ DISK WRITE SWAPIN IO>2341 be/4 root 0.0 B/s 5.2 M/s 0.0 % syslog5678 be/4 user 0.0 B/s 2.1 M/s 0.0 % app.logSomething’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:
# 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:
- Disable logging entirely
- Log only errors (not info/debug)
- Batch writes instead of immediate
Real Numbers
On a typical web server:
- With atime + constant logging: ~1000 writes/sec → ~36 million writes/day
- With noatime + tmpfs logs: ~100 writes/sec → ~3.6 million writes/day
- With noatime + tmpfs logs + less journald: ~50 writes/sec → ~1.8 million writes/day
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:
# 1. Check drive healthsudo 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 servicesKey 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.