我正在研究如何为我的服务器磁盘配置一些睡眠计划,但看起来我无法更改驱动器上的任何设置。我正在寻找这方面的帮助,因为我对配置hdparm
设置非常不熟悉。
错误信息
sudo hdparm -B 127 /dev/sda
/dev/sda:
setting Advanced Power Management level to 0x7f (127)
SG_IO: bad/missing sense data, sb[]: 70 00 05 00 00 00 00 0a 00 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
APM_level = 164
驱动器信息
sudo hdparm -I /dev/sda
/dev/sda:
ATA device, with non-removable media
Model Number: WDC WD100EMAZ-00WJTA0
Serial Number: 'REDACTED'
Firmware Revision: 83.H0A83
Transport: Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0; Revision: ATA8-AST T13 Project D1697 Revision 0b
Standards:
Used: unknown (minor revision code 0x0029)
Supported: 9 8 7 6 5
Likely used: 9
Configuration:
Logical max current
cylinders 16383 16383
heads 16 16
sectors/track 63 63
--
CHS current addressable sectors: 16514064
LBA user addressable sectors: 268435455
LBA48 user addressable sectors: 19532873728
Logical Sector size: 512 bytes
Physical Sector size: 4096 bytes
Logical Sector-0 offset: 0 bytes
device size with M = 1024*1024: 9537536 MBytes
device size with M = 1000*1000: 10000831 MBytes (10000 GB)
cache/buffer size = unknown
Form Factor: 3.5 inch
Nominal Media Rotation Rate: 5400
Capabilities:
LBA, IORDY(can be disabled)
Queue depth: 32
Standby timer values: specd by Standard, no device specific minimum
R/W multiple sector transfer: Max = 16 Current = 0
Advanced power management level: 164
DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6
Cycle time: min=120ns recommended=120ns
PIO: pio0 pio1 pio2 pio3 pio4
Cycle time: no flow control=120ns IORDY flow control=120ns
Commands/features:
Enabled Supported:
* SMART feature set
Security Mode feature set
* Power Management feature set
* Write cache
* Look-ahead
* Host Protected Area feature set
* WRITE_BUFFER command
* READ_BUFFER command
* NOP cmd
* DOWNLOAD_MICROCODE
* Advanced Power Management feature set
Power-Up In Standby feature set
* SET_FEATURES required to spinup after power up
SET_MAX security extension
* 48-bit Address feature set
* Device Configuration Overlay feature set
* Mandatory FLUSH_CACHE
* FLUSH_CACHE_EXT
* SMART error logging
* SMART self-test
* Media Card Pass-Through
* General Purpose Logging feature set
* WRITE_{DMA|MULTIPLE}_FUA_EXT
* 64-bit World wide name
* URG for READ_STREAM[_DMA]_EXT
* URG for WRITE_STREAM[_DMA]_EXT
* WRITE_UNCORRECTABLE_EXT command
* {READ,WRITE}_DMA_EXT_GPL commands
* Segmented DOWNLOAD_MICROCODE
unknown 119[6]
unknown 119[7]
* Gen1 signaling speed (1.5Gb/s)
* Gen2 signaling speed (3.0Gb/s)
* Gen3 signaling speed (6.0Gb/s)
* Native Command Queueing (NCQ)
* Host-initiated interface power management
* Phy event counters
* NCQ priority information
* READ_LOG_DMA_EXT equivalent to READ_LOG_EXT
Non-Zero buffer offsets in DMA Setup FIS
* DMA Setup Auto-Activate optimization
Device-initiated interface power management
In-order data delivery
* Software settings preservation
unknown 78[7]
unknown 78[10]
unknown 78[11]
* SMART Command Transport (SCT) feature set
* SCT Write Same (AC2)
* SCT Error Recovery Control (AC3)
* SCT Features Control (AC4)
* SCT Data Tables (AC5)
* SANITIZE feature set
* OVERWRITE_EXT command
* Extended number of user addressable sectors
* WRITE BUFFER DMA command
* READ BUFFER DMA command
Security:
Master password revision code = 65534
supported
not enabled
not locked
not frozen
not expired: security count
not supported: enhanced erase
1006min for SECURITY ERASE UNIT.
Logical Unit WWN Device Identifier: 5000cca273dc4eaf
NAA : 5
IEEE OUI : 000cca
Unique ID : 273dc4eaf
Checksum: correct
硬件和操作系统:
- Proxmox 7.4-17
- 连接到 DELL HBA330 J7TNV 12Gb/s 第三代 LSI SAS3008 HBA 9300 9311-8i 的驱动器
- WDC WD100EMAZ-00WJTA0 驱动器型号
- 磁盘是使用 Proxmox 主机配置的 Raid Z2 阵列的一部分。
目标
我希望成功配置这些驱动器在 10 分钟不活动后进入睡眠状态:
hdparm -S 120 /dev/sda \
hdparm -S 120 /dev/sdb \
hdparm -S 120 /dev/sdc \
hdparm -S 120 /dev/sdf \
hdparm -S 120 /dev/sdg \
hdparm -S 120 /dev/sdh
考虑到所有 spindown 配置的 APM 必须小于 128。
答案1
根据 ACS-3(PDF):
4.6 Advanced Power Management (APM) feature set
...
The APM feature set is independent of the Standby timer (see 4.15.3).
If the APM feature set is enabled and the Standby timer is enabled,
then the device shall go to the PM:2 Standby state if:
a) the Standby timer expires; or
b) a vendor specific APM algorithm indicates that the PM:2 Standby
state should be entered.
考虑到所有 spindown 配置的 APM 必须小于 128。
因此,据我所知,这实际上只是指b)
,即 APM 级别 >= 128,APM algorithm
永远不会indicate that the PM:2 Standby state should be entered
使用。这并不意味着 APM 级别/算法会使待机计时器无效。
根据4.15.3 Standby timer
,阻止待机定时器“工作”的唯一原因是a media access command is received
。我认为media access command
是指触发读/写操作的命令。If a media access command is received and the Standby timer is enabled, the Standby timer is reinitialized to the value specified by the most recent IDLE command ... and started.
(根据 的手册页hdparm
,发送的命令-S 120
应该是 IDLE 命令。)
答案2
该命令hdparm -S 120 /dev/sda
应使驱动器在 10 分钟不活动后进入休眠状态。但是,这是否有效取决于特定 HDD 的固件。如果您尝试设置 APM 级别但hdparm -S
没有成功,那么您拥有的特定驱动器可能不支持这些设置。
我有一些驱动器不响应hdparm
。对于其中一些,我很幸运地改用打开海箱。此工具可以使用 不支持的扩展电源条件 (EPC) 配置电源设置hdparm
。
使用 openSeaChest,您可以使用以下方式检查 HDD 的当前 EPC 电源设置:
openSeaChest_PowerControl -d /dev/sdb --showEPCSettings
此命令的输出还将明确 HDD 是否支持 EPC。如果支持,则可以使用以下命令更改 EPC 的电源设置:
openSeaChest_PowerControl -d /dev/sdX --idle_c MILLISECONS --standby_z MILLISECONS
将磁盘的空闲 C 和待机 C 时间设置sdX
为MILLISECONDS
毫秒:
如果使用 EPC 也不起作用,则hd-idle
可以将其作为最后的手段。此程序不依赖于磁盘上的固件自动旋转。相反,它用软件监控磁盘,并在一段时间不活动后将其旋转下来。这甚至适用于无法自行旋转的磁盘。以下命令在几秒sdX
后使磁盘旋转。SECONDS
hd-idle -a /dev/sdX -i SECONDS
要在 10 分钟后关闭所有磁盘,可以使用以下命令:
hd-idle -i 0
-a /dev/sda -i 600 -a /dev/sdb -i 600
-a /dev/sdc -i 600 -a /dev/sdf -i 600
-a /dev/sdh -i 600 -a /dev/sdg -i 600
该hd-idle
软件包还附带一个 systemd 服务,可在启动时启用该服务以打开 spindown。