Is it safe to use hdparm command to get or set hard disk parameters under Linux?

by on April 7, 2006 · 0 comments· LAST UPDATED April 7, 2006

in

hdparm command provides a command line interface to various hard disk ioctls supported by the stock Linux ATA/IDE device driver subsystem. Some options may work correctly only with the latest kernels.

Getting hard disk information
You can safely use hdparm to get hard disk information. For example, try out following command to get information about SCSI hard disk (login as the root user):

# hdparm /dev/sda

OR get detailed information:

# hdparm –I /dev/hda

Output:

/dev/hdb:
ATA device, with non-removable media
Model Number:       SAMSUNG SP0822N
Serial Number:      S06QJ10Y123456
Firmware Revision:  WA100-31
Standards:
Used: ATA/ATAPI-6 T13 1410D revision 1
Supported: 7 6 5 4 & some of 7
Configuration:
Logical  max current
cylinders 16383 65535
heads  16 1
sectors/track 63 63
--
CHS current addressable sectors:    4128705
LBA    user addressable sectors:  156368016
LBA48  user addressable sectors:  156368016
device size with M = 1024*1024:       76351 MBytes
device size with M = 1000*1000:       80060 MBytes (80 GB)
Capabilities:
LBA, IORDY(can be disabled)
Queue depth: 1
Standby timer values: spec'd by Standard, no device specific minimum
R/W multiple sector transfer: Max = 16 Current = ?
Recommended acoustic management value: 254, current value: 0
DMA: mdma0 mdma1 mdma2 udma0 udma1 *udma2 udma3 udma4 udma5
    Cycle time: min=120ns recommended=120ns
PIO: pio0 pio1 pio2 pio3 pio4
    Cycle time: no flow control=120ns  IORDY flow control=120ns
Commands/features:
Enabled Supported:
NOP cmd
  * READ BUFFER cmd
  * WRITE BUFFER cmd
  * Host Protected Area feature set
  * Look-ahead
  * Write cache
  * Power Management feature set
Security Mode feature set
SMART feature set
  * FLUSH CACHE EXT command
  * Mandatory FLUSH CACHE command
  * Device Configuration Overlay feature set
  * 48-bit Address feature set
Automatic Acoustic Management feature set
SET MAX security extension
  * DOWNLOAD MICROCODE cmd
  * SMART self-test
  * SMART error logging
Security:
Master password revision code = 65534
supported
not enabled
not locked
not frozen
not expired: security count
supported: enhanced erase
50min for SECURITY ERASE UNIT. 50min for ENHANCED SECURITY ERASE UNIT.
HW reset results:
CBLID- below Vih
Device num = 1 determined by the jumper
Checksum: correct

You can also find out how fast your hard disk can read or write (cache) data. Run following command 2-3 times to get meaningful results:

# hdparm –tT /dev/hda

Output:

/dev/hda:
Timing cached reads:   1008 MB in  2.00 seconds = 502.96 MB/sec
Timing buffered disk reads:   54 MB in  3.09 seconds =  17.46 MB/sec

Setting hard disk parameters
Setting parameter can be dangerous. Your OS/Linux kernel is optimized to autodetect the correct settings for most hard drives. Do not try to set new values using hdparm command. Wrong parameter may result into loss and/or corruption of data. Read man page of hdparm for all options. You can configure your hard disk using /etc/hdparm.conf under Debian Linux. Under RedHat Linux try /etc/sysconfig/harddisk file.

Caution: Do not modify above files, leave files, as it is unless you know exactly what you are doing.

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 0 comments… add one now }

Leave a Comment

Tagged as:

Previous Faq:

Next Faq: