← 返回命令列表

Linux command

hdparm 命令

安全

权限或系统影响较大,执行前请核对目标。

常用示例

Get device identification info

sudo hdparm -I [/dev/sda]

Test buffered and cached read speed

sudo hdparm -tT [/dev/sda]

Get or set write-caching

sudo hdparm -W [1] [/dev/sda]

Show current power mode status

sudo hdparm -C [/dev/sda]

Set Advanced Power Management level

sudo hdparm -B [127] [/dev/sda]

Set standby timeout

sudo hdparm -S [60] [/dev/sda]

Force drive into standby mode

sudo hdparm -y [/dev/sda]

说明

hdparm gets and sets SATA/IDE hard drive parameters. It can display device information, configure power management settings, test performance, and enable or disable drive features.

参数

-I
Display detailed device identification
-i
Display kernel's cached identification info
-B _value_
Get or set Advanced Power Management (1-254)
-C
Display current power mode status
-S _value_
Set standby timeout (0=off, 1-240=5s increments, 241-251=30m increments)
-y
Force drive into standby mode
-Y
Force drive into sleep mode (may require hard reset)
-t
Test buffered read speed
-T
Test cache read speed
-g
Display drive geometry (cylinders, heads, sectors, size)
-M _value_
Get or set Automatic Acoustic Management (0=off, 128=quiet, 254=fast)
-W _value_
Get or set write-caching (0=off, 1=on)
-F
Flush drive write cache
--security-erase _password_
Secure erase the drive (WARNING: destroys all data)

FAQ

What is the hdparm command used for?

hdparm gets and sets SATA/IDE hard drive parameters. It can display device information, configure power management settings, test performance, and enable or disable drive features.

How do I run a basic hdparm example?

Run `sudo hdparm -I [/dev/sda]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -I do in hdparm?

Display detailed device identification