Skip to main content
Solved

Extension attribute to see if TRIM support is enabled on a 3rd party SSD

  • August 25, 2016
  • 1 reply
  • 9 views

Forum|alt.badge.img+18

I've recently been replacing our drives with SSD in older MacBooks and MacBook Pros and have started using a scripted version of enabling trim support if there is an ssd installed, however I wanted to make an extension attribute to check that it is acutally enabled. Any ideas?

Gabe Shackney
Princeton Public Schools

Best answer by thoule

#!/bin/bash

TrimCheck=`system_profiler -detailLevel Mini SPSerialATADataType | grep -w TRIM | awk '{print $3;}'`

if [[ ! $TrimCheck ]]; then
  echo "No Device supporting TRIM found."
  echo "<result>Not Applicable</result>"
elif [[ $TrimCheck == "Yes" ]]; then
  echo "Device found and TRIM is Enabled."
  echo "<result>Enabled</result>"
elif [[ $TrimCheck == "No" ]]; then
  echo "Device found and TRIM is Disabled."
  echo "<result>Disabled</result>"
else
  echo "Error"
  echo "<result>Error</result>"
fi

1 reply

Forum|alt.badge.img+15
  • Contributor
  • Answer
  • August 25, 2016
#!/bin/bash

TrimCheck=`system_profiler -detailLevel Mini SPSerialATADataType | grep -w TRIM | awk '{print $3;}'`

if [[ ! $TrimCheck ]]; then
  echo "No Device supporting TRIM found."
  echo "<result>Not Applicable</result>"
elif [[ $TrimCheck == "Yes" ]]; then
  echo "Device found and TRIM is Enabled."
  echo "<result>Enabled</result>"
elif [[ $TrimCheck == "No" ]]; then
  echo "Device found and TRIM is Disabled."
  echo "<result>Disabled</result>"
else
  echo "Error"
  echo "<result>Error</result>"
fi