Improve SSD performance with fstrim under Linux
Before proceeding further, you should check that your system supports TRIM by running this command (replace /dev/sda with your SSD):
:~$ sudo hdparm -I /dev/sda | grep "TRIM supported"
If everything is ok, you should receive the following response:
* Data Set Management TRIM supported (limit 8 blocks)
Next, create a new file that will hold the script for the cron job:
:~$ gksu gedit /etc/cron.daily/trim
And then paste the following lines:
#!/bin/sh
LOG=/var/log/trim.log
echo "*** $(date -R) ***" >> $LOG
fstrim -v / >> $LOG
Finally, you can now make the script executable by running this command:
:~$ sudo chmod +x /etc/cron.daily/trim
To test that it is running, you can use this command:
:~$ sudo /etc/cron.daily/trim && cat /var/log/trim.log
*** Thu, 12 Sep 2013 16:42:39 +0200 ***
/: 814514176 bytes were trimmed
Written by Andrei Sambra
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Linux
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#