Skip to content

Instantly share code, notes, and snippets.

@tlipinski
Created August 3, 2012 22:27
Show Gist options
  • Save tlipinski/3252144 to your computer and use it in GitHub Desktop.
Save tlipinski/3252144 to your computer and use it in GitHub Desktop.
Simple script that checks if SSD drive has TRIM enabled.
path=$1
drive=$2
name=/_tempfile_
file=$path$name
echo Test file: $file
seq 1 1000 > $file
sync; sleep 2
address=`hdparm --fibmap $file | tail -n 1 | cut -d' ' -f15-17`
hdparm --read-sector $address /dev/$drive | tail -n 1
rm $file
sync; sleep 2
hdparm --read-sector $address /dev/$drive | tail -n 1
@tlipinski
Copy link
Author

sudo ./trimsupport.sh / sda
Output if enabled:

3531 0a32 3531 0a33 3531 0a34 3531 0a35
0000 0000 0000 0000 0000 0000 0000 0000

Output if disabled:

3531 0a32 3531 0a33 3531 0a34 3531 0a35
3531 0a32 3531 0a33 3531 0a34 3531 0a35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment