fstrim is used on a mounted filesystem to discard (or "trim") blocks
which are not in use by the filesystem.  This is useful for solid-
state drives (SSDs) and thinly-provisioned storage. Running fstrim
frequently, or even using mount -o discard, might negatively affect
the lifetime of poor-quality SSD devices.  For most desktop and server
systems a sufficient trimming frequency is once a week.  Note that not
all devices support a queued trim, so each trim command incurs a 
performance penalty on whatever else might be trying to use the disk 
at the time.

Only this one operation is required to support SSDs in Linux.  The simplest way to implement this is to run a ‘fstrim’ script in cron.weekly or make it executable using ‘sudo chmod +x fstrim’ :

#!/bin/sh
# Run “fstrim” command
LOG=/var/log/fstrim.log
/sbin/fstrim -v / >>$LOG
echo “Time: $(date)” >>$LOG
exit 0

Leave a Reply

Your email address will not be published. Required fields are marked *