使用 sdparm 的硬盘状态信息

hard disk status info with sdparm

我有一个用于备份的外部硬盘,它通过 USB 连接到我的 linux-计算机。因为 hdparm 不工作,我试着用 sudo sdparm -C stop /dev/sdf1 来降低磁盘的转速。我怎样才能知道磁盘现在是否真的在休眠?

如果你不想使用 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.