hdparm
Overview
hdparm gets and sets ATA/SATA disk parameters: identify data, power management, read-ahead, write-cache, and controversial performance timings. Useful for bare-metal disk troubleshooting. Wrong settings can risk data loss — especially write-cache and dangerous benchmark flags.
Prefer vendor tools / smartmontools for health; use hdparm carefully.
Syntax
hdparm [options] deviceDevice is typically /dev/sda (whole disk), not a partition.
Common Options
| Option | Description |
|---|---|
-I |
Detailed identity information |
-i |
Kernel’s identify summary |
-C |
Power mode status |
-M |
AAM acoustic (legacy) |
-B |
APM level |
-S |
Standby timeout |
-W |
Write-cache on/off query/set |
-a / -A |
Read-ahead |
-t / -T |
Timing buffered disk / cache reads (benchmark load) |
--security-* |
ATA security (dangerous) |
-y / -Y |
Standby / sleep now |
-z |
Reread partition table |
Examples with Explanations
Identify
sudo hdparm -I /dev/sda
sudo hdparm -i /dev/sda
sudo smartctl -a /dev/sdaPower status
sudo hdparm -C /dev/sdaRead-only info queries (safer)
sudo hdparm -W /dev/sda
sudo hdparm -a /dev/sdaBenchmarks (I/O heavy; maintenance window)
sudo hdparm -tT /dev/sdaInterprets sequential throughput roughly; not a substitute for fio.
Write cache (know the risk)
sudo hdparm -W /dev/sda
# enabling write cache without barriers/UPS can lose data on power lossPrefer filesystem/mount and device defaults unless you know the storage stack.
Reread partitions
sudo hdparm -z /dev/sda
# often partprobe / blockdev --rereadpt also usedNotes / Pitfalls
- Never experiment with
--security-erase/ passwords on disks you care about without full understanding. - USB bridges and NVMe devices may ignore or poorly implement ATA commands — NVMe has
nvmeCLI. - Cloud block volumes often virtualize away hdparm usefulness.
- Timing tests stress disks — avoid on production peaks.
- Requires root.
2026-relevant notes
- NVMe dominates SSDs: learn
nvme list,nvme smart-logalongsidehdparm. - For spinning rust power policies on laptops, distro power tools may be safer than manual
-B/-S. - Always have backups before storage experiments.
Additional Resources
man hdparm(read warnings)