hdparm(8)
Get and set SATA/IDE device parameters and performance characteristics.
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
| Flag | What it does |
|---|---|
-i | Display drive identification information (model, serial, firmware) |
-I | Display detailed drive information from IDENTIFY command (extensive) |
-t | Perform device read timing benchmark |
-T | Perform cached reads timing benchmark (faster, tests buffer cache) |
-d | Get/set DMA (Direct Memory Access) mode; use with 1 to enable |
-X | Set transfer mode speed (e.g., -X udma5 for UDMA mode 5) |
-a | Get/set sector count for filesystem read-ahead; use with number |
-A | Disable/enable IDE read-ahead; use with 0 or 1 |
-S | Set standby timeout in seconds (0 disables, use with number) |
-Y | Set device to sleep mode immediately |
-W | Get/set write caching; use with 0 to disable, 1 to enable |
-C | Check if drive supports power management features |
Examples
Display basic identification info for the first SATA drive
hdparm -i /dev/sdaRun read speed benchmark to measure raw drive performance
hdparm -t /dev/sdaRun cached read benchmark to test buffer memory speed (much faster)
hdparm -T /dev/sdaEnable DMA mode on /dev/sda to improve transfer speeds
sudo hdparm -d 1 /dev/sdaSet drive to spin down after 10 minutes (120×5 sec units) of inactivity
sudo hdparm -S 120 /dev/sdaCheck the current power state of the drive (active, idle, standby, sleeping)
hdparm -C /dev/sdaDisable write caching on /dev/sda (safer but slower for databases)
sudo hdparm -W 0 /dev/sdaDisplay detailed drive info and filter for RPM specifications
hdparm -I /dev/sda | grep -i rpm