Skip to main content

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

#!/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