On ubuntu 14.04 how do you check if TRIM is on for an SSD drive

On ubuntu 14.04 how do you check if TRIM is on for an SSD drive? Other settings worth verifying for an SSD drive?


Solution 1:

To see the details for your weekly cron jobs, change directory to /etc/cron.weekly or include it in the command as below:

more /etc/cron.weekly/fstrim 

You should see an output which looks something like:

#!/bin/sh
# trim all mounted file systems which support it
/sbin/fstrim --all || true

If this is present trim is active/checked and executed once a week. The help on this command will show you...

fstrim --help

Usage:
 fstrim [options] <mount point>

Options:
 -a, --all           trim all mounted filesystems that are supported
 -o, --offset <num>  the offset in bytes to start discarding from
 -l, --length <num>  the number of bytes to discard
 -m, --minimum <num> the minimum extent length to discard
 -v, --verbose       print number of discarded bytes

 -h, --help     display this help and exit
 -V, --version  output version information and exit

To see if trim is supported (change sda if you have more than 1 disks):

sudo hdparm -I /dev/sda | grep "TRIM supported"

and it should show something similar to this:

*   Data Set Management TRIM supported (limit 8 blocks)