在/lib/hdparm/hdparm-functions
中的约63行位置有:
# Only activate APM on disks that support it.
if [ -z "$ID_ATA_FEATURE_SET_APM" ]; then
local ID_ATA_FEATURE_SET_APM="$(udevadm info -n "$1" -q property 2>/dev/null | sed -n 's/^ID_ATA_FEATURE_SET_APM=//p')" || true
fi
在其下方追加一段:
# Only activate APM on disks that support it.
if [ -z "$ID_ATA_FEATURE_SET_APM" ]; then
local ID_ATA_FEATURE_SET_APM="$(udevadm info -n "$1" -q property 2>/dev/null | sed -n 's/^ID_ATA_FEATURE_SET_APM=//p')" || true
fi
# udevadm 不一定支持获取新硬盘的APM支持状况, 在结果为空的时候采用替代方案
if [ -z "$ID_ATA_FEATURE_SET_APM" ]; then
local ID_ATA_FEATURE_SET_APM="$(( ! $(hdparm -B "$1" | grep -c "not supported") ))" || true
fi