Site icon New Generation Enterprise Linux

Reclaiming Unused SSD Blocks with Periodic Fstrim

Disk & Filesystem Management (Du/Df/Lsblk/Fstrim)

Reclaiming Unused SSD Blocks with Periodic Fstrim

🧩 The Challenge

Solid state drives can suffer from degraded write performance over time because the controller is unaware of blocks no longer in use by the filesystem. This results in unnecessary overhead during garbage collection cycles.

💡 The Fix

Enable the built-in systemd timer that periodically sends discard commands to the filesystem to notify the SSD controller which blocks are ready for reuse.

systemctl enable --now fstrim.timer

⚙️ Why It Works

This command activates a weekly background task that instructs the kernel to discard unused data blocks on mounted filesystems, which optimizes SSD lifespan and write speeds.

🚀 Pro-Tip: Run fstrim -av manually to perform an immediate, verbose discard operation on all supported mounted filesystems without waiting for the timer.

Linux Tips & Tricks | © ngelinux.com | 7/11/2026

0 0 votes
Article Rating
Exit mobile version