Latest / Big Iron Radio / Homelab Brief - Keeping SSDs Healthy: fstrim vs discard
Transcript
- 0:02Welcome to the Homelab Brief from Big Iron.
- 0:06Today, keeping SSDs healthy on Linux, the F-Strim timer versus the discard mount option.
- 0:14Quick note, this is an AI voice drawn from a Big Iron guide.
- 0:18Links below.
- 0:20Quick background first.
- 0:22Trim is how your SSD learns which blocks are actually free, so it can stay fast and wear evenly over time.
- 0:28The only real question is when to send those Trim commands in a weekly batch, or the instant every file gets deleted.
- 0:37That's F-Strim versus discard.
- 0:39The verdict is clear.
- 0:41Use the weekly F-Strim timer for almost every SSD.
- 0:45On Debian and most modern distros, F-Strim timer is already the default it runs F-Strim all once a week, batched.
- 0:52It's gentler on the I-slash-O path, and it sidesteps a whole class of firmware bugs that per deletion Trim can trip over.
- 1:01The other option, inline discard, fires a Trim on every single deletion.
- 1:06On older drives that caused real latency stalls, which is why it fell out of favor.
- 1:11On modern drives it's less of a problem, but for a plain file system, the weekly batch is still the safer, quieter default.
- 1:18There's basically no upside to inline discard on XT4 or XFS.
- 1:24The exceptions are worth knowing, because each file system has its own switch.
- 1:29On BTRFS, use discard equals a sync that's the one-place inline-style Trim actually wins, giving you freshness without the latency.
- 1:38On ZFS, set auto-trim equals on for continuous background Trim.
- 1:43And two pass-through gotchas.
- 1:44On a Lux-encrypted SSD, you must add discard in Cryptab, and under LVM Set Issue discards to one otherwise the Trim never reaches the drive underneath.
- 1:56And always verify, because a silent no-op is the worst case you think Trim running, and it isn't.
- 2:02Run LSBLKD to confirm the device even supports Trim, then sudo f-strim v-slash to see how much it actually trimmed.
- 2:11If it reports bytes freed, you're set.
- 2:13The full command list is in the show notes.
- 2:17That's your brief.