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

GabeShack
Valued Contributor III

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

Gabe Shackney
Princeton Public Schools
1 ACCEPTED SOLUTION

thoule
Valued Contributor II
#!/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

View solution in original post

1 REPLY 1

thoule
Valued Contributor II
#!/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