English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Linux hdparm command

Linux Command大全

Linux hdparm command is used to display and set hard disk parameters.

hdparm can detect, display, and set parameters of IDE or SCSI hard disks.

Syntax

hdparm [-CfghiIqtTvyYZ][-a <cache partition>][-A <0 or1>][-c <I/O mode>][-d <0 or1>][-k <0 or1>][-K <0 or1>][-m <partition number>][-n <0 or1>][-p <PIO mode>][-P <partition number>][-r <0 or1>][-S <time>][-u <0 or1>][-W <0 or1>][-X <transfer mode>][device]

Parameter description:

  • -a<cache partition> Set the number of partitions in the block area pre-loaded when reading files. If the <cache partition> option is not added, the current setting is displayed.
  • -A<0 or1> Enable or disable the caching function when reading files.
  • -c<I/O mode> Set IDE32Bit I/O mode.
  • -C Detect the power management mode of the IDE hard disk.
  • -d<0 or1> Set the DMA mode of the disk.
  • -f Write the data in the memory buffer to the hard disk and clear the buffer.
  • -g Display parameters such as track, head, and zone of the hard disk.
  • -h Display help.
  • -i Display the hardware specification information of the hard disk, which is provided by the hard disk itself at boot time.
  • -I Directly read the hardware specification information provided by the hard disk.
  • -k<0 or1> Keep the following when resetting the hard disk:-dmu parameter settings.
  • -K<0 or1> Keep the following when resetting the hard disk:-APSWXZ parameter settings.
  • -m<partition number> Set the number of partitions for the multi-zone access of the hard disk.
  • -n<0 or1> Ignore errors that occur during hard disk writing.
  • -p<PIO mode> Set the PIO mode of the hard disk.
  • -P<partition number> Set the number of partitions for the internal cache of the hard disk.
  • -q Do not display any information on the screen when executing subsequent parameters.
  • -r<0 or1> Set the read and write mode of the hard disk.
  • -S<time> Set the waiting time before the hard disk enters power-saving mode.
  • -Evaluate the read efficiency of the hard disk.
  • -T Evaluate the read efficiency of the hard disk cache.
  • -u<0 or1> Allow other interrupt requests to execute simultaneously during hard disk access.
  • -v Display the relevant settings of the hard disk.
  • -W<0 or1> Close/Enable disk write caching, each disk has read and write caching, sometimes the efficiency of closing disk write caching is higher than that of opening disk write caching, so of course we choose the former.
  • -X<Transmission mode> Set the transmission mode of the hard disk.
  • -y Put IDE hard disks into power-saving mode.
  • -Y Put IDE hard disks into sleep mode.
  • -Z Turn off the automatic power-saving feature of some Seagate hard disks.

Online Examples

Display the relevant settings of the hard disk

# hdparm /dev/sda
 /dev/sda:
 IO_support = 0 (default 16-bit)
 readonly = 0 (off)
 readahead = 256 (on)
 geometry = 19929[Cylinder number]/255[Head number]/63[Sector count], sectors = 320173056[Total sectors], start = 0[Start sector number]

Display the cylinder, head, and sector numbers of the hard disk

# hdparm -g /dev/sda
 /dev/sda:
 geometry = 19929[Cylinder number]/255[Head number]/63[Sector count], sectors = 320173056[Total sectors], start = 0[Start sector number]

Evaluate the read efficiency of the hard disk

 hdparm -t /dev/sda
 /dev/sda:
 Timing buffered disk reads: 166 MB in 3.03 seconds = 54.85 MB/sec
 [[email protected] ~]# hdparm -t /dev/sda
 /dev/sda:
 Timing buffered disk reads: 160 MB in 3.01 seconds = 53.11 MB/sec
 [[email protected] ~]# hdparm -t /dev/sda
 /dev/sda:
 Timing buffered disk reads: 166 MB in 3.00 seconds = 55.31 MB/sec

Linux Command大全