LLI Wiki — My Digital Knowledge Base

Linux: check and enable SSD TRIM with fstrim

Commands to check TRIM support, run fstrim and enable fstrim.timer.

On an SSD under Linux, the TRIM command tells the drive which blocks are free so it can keep its performance. This memo gathers the commands to check TRIM support, run it manually and automate it.

# Check that the disk supports TRIM
hdparm -I /dev/sda | grep TRIM
lsblk -D

# Run a manual TRIM on the root filesystem (-v: print the amount trimmed)
sudo fstrim -v /

# Enable the automatic weekly TRIM
sudo systemctl enable fstrim.timer

# Review past runs
journalctl -u fstrim

Notes

Mastodon LLIMastodon SocialFosstodon