gpt4 book ai didi

linux - 使用 sdparm 获取硬盘状态信息

转载 作者:太空宇宙 更新时间:2023-11-04 05:52:37 27 4
gpt4 key购买 nike

我有一个用于备份的外部硬盘,它通过 USB 与我的 Linux 计算机连接。由于 hdparm 无法工作,我尝试使用 sudo sdparm -C stop /dev/sdf1 来降低磁盘转速。 。我怎样才能知道磁盘现在是否真的处于 sleep 状态?

最佳答案

如果您不想使用 hdparm,您也可以使用 smartctl 来收集此信息。

为此,您可以运行如下命令:

 sudo smartctl  -a  -n sleep /dev/sda

您基本上对 -n 参数感兴趣,它包含以下文档。

   -n POWERMODE, --nocheck=POWERMODE
[ATA only] Specifies if smartctl should exit before performing any checks when the device is in a low-power mode. It may be used to prevent
a disk from being spun-up by smartctl. The power mode is ignored by default. A nonzero exit status is returned if the device is in one of
the specified low-power modes (see RETURN VALUES below).

Note: If this option is used it may also be necessary to specify the device type with the ´-d´ option. Otherwise the device may spin up due
to commands issued during device type autodetection.

The valid arguments to this option are:

never - check the device always, but print the power mode if ´-i´ is specified.

sleep - check the device unless it is in SLEEP mode.

standby - check the device unless it is in SLEEP or STANDBY mode. In these modes most disks are not spinning, so if you want to prevent a
disk from spinning up, this is probably what you want.

idle - check the device unless it is in SLEEP, STANDBY or IDLE mode. In the IDLE state, most disks are still spinning, so this is probably
not what you want.

关于linux - 使用 sdparm 获取硬盘状态信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29352311/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com