hdparm command line utility and its examples

The “hdparm” command is used to update and view parameters of hard disk drives. Which can be used to perform various tasks like checking the disk’s performance, enabling or disabling certain features, changing the disk’s power management settings, and more.

  • Using hdparm we can get/set SATA/IDE device parameters.
  • It comes from “hdparm-9.16” package.
  • Configuration Files:
    /etc/hdparm.conf
  • Path: /sbin/hdparm

Examples:

1. To get the device parameters

# hdparm /dev/sde

2. To get the sector count of the file system

# hdparm /dev/sde

3. To get the IDE read ahead look ahead feature

# hdparm -A /dev/sde
# hdparm -a /dev/sde

4. To get the bus state (****)

# hdparm -b /dev/sde

5. To get the bus state

# hdparm -b /dev/sda

6. To query/set the adavanced power management status

# hdparm -B /dev/sda

7. To query/set the 32 Bit I/O status

# hdparm -c /dev/sda

8. To see the current IDE power mode status

# hdparm -C /dev/sda

9. To enable/disable “using_dma” flag

# hdparm -d /dev/sda

10. To freeze/lock the current drive configuration

# hdparm –dco-freeze /dev/sda

11. To query and dump information regarding drive configuration settings

# hdparm –dco-identify /dev/sda

12. To Reset all drive settings

# hdparm –dco-restore /dev/sda

13. To bypass the page cache for direct reads

# hdparm –direct /dev/sda

14. To Enable/disable the on-drive defect management feature

# hdparm -D /dev/sda

15. To set CD / DVD drive speed

# hdparm -E /dev/sda

16. To sync and flush the buffer cache

# hdparm -f /dev/sda

17. To Flush the on-drive write cache buffer

# hdparm -F /dev/sda

18. To Display the drive geometry

# hdparm -g /dev/sda

19. To display terse usage information

# hdparm -h /dev/sda

20. To display identification info which kernel drivers have stored

# hdparm -i /dev/sda

21. To Request identification info directly from the drive

# hdparm -I /dev/sda

22. To Issue ATA IDLE_IMMEDIATE command, to put the drive into a lower power state

# hdparm –idle-immediate /dev/sda

23. To Issue an ATA IDLE_IMMEDIATE_WITH_UNLOAD command, to unload or park the heads and put the drive into lower power state

# hdparm –idle-unload /dev/sda

24. To dumps the driveâs identify data in hex to stdout

# hdparm –Istdout /dev/sda

25. To Get/set the keep_settings_over_reset flag for the drive

# hdparm -k /dev/sda

26. To Set the drive’s keep_features_over_reset flag

# hdparm -K /dev/sda

27. To Set the drive´s doorlock flag

# hdparm -L /dev/sda

28. To Get/set sector count for multiple sector I/O on the drive

# hdparm -m /dev/sda

29. To deliberately create a bad sector

# hdparm –make-bad-sector /dev/sda

30. To Get/set Automatic Acoustic Management (AAM) setting

# hdparm -M /dev/sda

31. To Get/set max visible number of sectors

# hdparm -N /dev/sda

32. To get/set “ignore write errors” flag in the driver

# hdparm -n /dev/sda

33. To Attempt to reprogram the IDE interface chipset for the specified PIO mode

# hdparm -p /dev/sda

34. To set maximum sector count for the drive´s internal prefetch mechanism

# hdparm -P /dev/sda

35. To Handle the next flag quietly,

# hdparm -q /dev/sda

36. To Put the drive into idle (low-power) mode

# hdparm -S /dev/sda

37. To perform timings of cache reads for benchmark and comparison purposes

# hdparm -T /dev/sda

38. To perform timings of device reads for benchmark and comparison purposes

# hdparm -t /dev/sda

39. To Get/set interrupt-unmask flag for the drive

# hdparm -u /dev/sda

40. To Display some basic settings

# hdparm -v

41. To display extra diagnostics from some commands

# hdparm –verbose

42. To get/set IDE/SATA drive´s write-caching feature

# hdparm -W /dev/sda

43. To set the IDE transfer mode for (E)IDE/ATA drives

# hdparm -X /dev/sda

44. To Force an IDE drive to immediately enter the low power consumption standby mode

# hdparm -y /dev/sda

45. To Force an IDE drive to immediately enter the lowest power consumption sleep mode

# hdparm -Y /dev/sda

46. To Force a kernel re-read of the partition table of the specified device

# hdparm -z /dev/sda

47. To Disable the automatic power-saving function of certain Seagate drives

# hdparm -Z /dev/sda

48. To Read the temperature from some (mostly Hitachi) drives

# hdparm -H /dev/sda

Leave a Reply

Your email address will not be published. Required fields are marked *