Ubuntu下hdparm.conf中APM和spindown_time设置不生效的解决方案
Zapic
2024-08-02 0

/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
评论 0
没有评论
评论已关闭
发表评论
评论 取消回复
Copyright © 2024 Zapic's Blog