$linuxjunkies
>

hdparm(8)

Get and set SATA/IDE device parameters and performance characteristics.

UbuntuDebianFedoraArch

Synopsis

hdparm [FLAGS] [DEVICE]

Description

hdparm is a command-line utility for reading and writing hard disk drive parameters on Linux systems. It allows you to tune performance, manage power features, enable DMA, and monitor drive health without rebooting.

Changes made with hdparm are typically not persistent across reboots unless configured in system startup scripts or udev rules. Use with caution on production systems, as incorrect parameters can cause data loss or system instability.

Common options

FlagWhat it does
-iDisplay drive identification information (model, serial, firmware)
-IDisplay detailed drive information from IDENTIFY command (extensive)
-tPerform device read timing benchmark
-TPerform cached reads timing benchmark (faster, tests buffer cache)
-dGet/set DMA (Direct Memory Access) mode; use with 1 to enable
-XSet transfer mode speed (e.g., -X udma5 for UDMA mode 5)
-aGet/set sector count for filesystem read-ahead; use with number
-ADisable/enable IDE read-ahead; use with 0 or 1
-SSet standby timeout in seconds (0 disables, use with number)
-YSet device to sleep mode immediately
-WGet/set write caching; use with 0 to disable, 1 to enable
-CCheck if drive supports power management features

Examples

Display basic identification info for the first SATA drive

hdparm -i /dev/sda

Run read speed benchmark to measure raw drive performance

hdparm -t /dev/sda

Run cached read benchmark to test buffer memory speed (much faster)

hdparm -T /dev/sda

Enable DMA mode on /dev/sda to improve transfer speeds

sudo hdparm -d 1 /dev/sda

Set drive to spin down after 10 minutes (120×5 sec units) of inactivity

sudo hdparm -S 120 /dev/sda

Check the current power state of the drive (active, idle, standby, sleeping)

hdparm -C /dev/sda

Disable write caching on /dev/sda (safer but slower for databases)

sudo hdparm -W 0 /dev/sda

Display detailed drive info and filter for RPM specifications

hdparm -I /dev/sda | grep -i rpm

Related commands