Use the fstrim Command to Trim an SSD in Linux

By | 2014/12/04

Instead of mounting with the discard option, consider using the fstrim command to trim your SSD!


To manually trim your SSD, use the fstrim command.

Exmaple:

stmiller@bruckner:~$ sudo fstrim -v /
[sudo] password for stmiller: 
/: 60656586752 bytes were trimmed

This can be put into a cron job to be run daily, at 10:00 hours:

$ sudo crontab -e

Paste in the following and save:

  0     10   *      *       *                 /sbin/fstrim  / >/dev/null

Rock on,