WEB DEVELOPMENT
[edit]

FSTrim

Linux man-page

To enable TRIM for an SSD on Debian 13, first check TRIM support with lsblk --discard. Then, enable the weekly periodic TRIM service with systemctl enable --now fstrim.timer and verify it's active with systemctl status fstrim.timer. For immediate TRIM, you can manually run sudo fstrim -v /.

Verify TRIM Support

Before enabling TRIM, confirm your SSD supports it by running the lsblk --discard command. Open a terminal, Type lsblk --discard and press Enter.


lsblk --discard

Look for non-zero values in the DISC-GRAN (discard granularity) and DISC-MAX (discard max bytes) columns for your SSD device (e.g., /dev/sda). If you see non-zero values, your SSD supports TRIM.

Enable the Periodic TRIM Service

Debian uses systemd's fstrim.timer for weekly TRIM operations.

To enable and start the timer, run:


sudo systemctl enable --now fstrim.timer

Check the status to ensure it's running and see when it's scheduled to run next:


systemctl status fstrim.timer

The default schedule is weekly.

Manually Run TRIM

You can also run TRIM manually at any time to trim all free space on your mounted partitions. Use the fstrim command with the -v option for verbose output:


sudo fstrim -v /

This command will trim the root filesystem (/). You can replace / with other mount points like /home to trim them specifically.