Linux hdparm Command

Linux 命令大全Linux Command Collection

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

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

Syntax

hdparm [-CfghiIqtTvyYZ][-a <快取分区>][-A <0或1>][-c <I/O模式>][-d <0或1>][-k <0或1>][-K <0或1>][-m <分区数>][-n <0或1>][-p <PIO模式>][-P <分区数>][-r <0或1>][-S <时间>][-u <0或1>][-W <0或1>][-X <传输模式>][设备]

Parameter Description:

  • -a<cache partition> Set the number of partitions to pre-store in the block area when reading files. If the <cache partition> option is not added, display the current setting.
  • -A<0 or 1> Enable or disable the cache function when reading files.
  • -c<I/O mode> Set the IDE 32-bit I/O mode.
  • -C Detect the power management mode of the IDE hard disk.
  • -d<0 or 1> 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 the hard disk's tracks, heads, sectors, and other parameters.
  • -h Display help.
  • -i Display the hardware specification information of the hard disk; this information is provided by the hard disk itself at boot time.
  • -I Directly read the hardware specification information provided by the hard disk.
  • -k<0 or 1> When resetting the hard disk, preserve the settings of the -dmu parameters.
  • -K<0 or 1> When resetting the hard disk, preserve the settings of the -APSWXZ parameters.
  • -m<sector count> Set the number of sectors for multi-sector access on the hard disk.
  • -n<0 or 1> Ignore errors that occur when writing to the hard disk.
  • -p<PIO mode> Set the PIO mode of the hard disk.
  • -P<sector count> Set the number of sectors for the hard disk's internal cache.
  • -q Do not display any information on the screen when executing subsequent parameters.
  • -r<0 or 1> Set the read/write mode of the hard disk.
  • -S<time> Set the waiting time before the hard disk enters power-saving mode.
  • -t Evaluate the read efficiency of the hard disk.
  • -T Evaluate the read efficiency of the hard disk cache.
  • -u<0 or 1> While the hard disk is being accessed, allow other interrupt requests to be executed simultaneously.
  • -v Display the related settings of the hard disk.
  • -W<0 or 1> Turn off/on the disk's write cache. Every disk has a read cache and a write cache. Sometimes turning off the disk's write cache is more efficient than turning it on, so of course we choose the former.
  • -X<transfer mode> Set the transfer mode of the hard disk.
  • -y Put the IDE hard disk into power-saving mode.
  • -Y Put the IDE hard disk into sleep mode.
  • -Z Disable the automatic power-saving function of certain Seagate hard disks.

Examples

Display the related settings of the hard disk:

# hdparm /dev/sda
 /dev/sda:
 IO_support = 0 (default 16-bit)
 readonly = 0 (off)
 readahead = 256 (on)
 geometry = 19929[柱面数]/255[磁头数]/63[扇区数], sectors = 320173056[总扇区数], start = 0[起始扇区数]

Display the hard disk's cylinders, heads, and sector count.

# hdparm -g /dev/sda
 /dev/sda:
 geometry = 19929[柱面数]/255[磁头数]/63[扇区数], sectors = 320173056[总扇区数], start = 0[起始扇区数]

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
 [root@linuxso.com ~]# hdparm -t /dev/sda
 /dev/sda:
 Timing buffered disk reads: 160 MB in 3.01 seconds = 53.11 MB/sec
 [root@linuxso.com ~]# hdparm -t /dev/sda
 /dev/sda:
 Timing buffered disk reads: 166 MB in 3.00 seconds = 55.31 MB/sec

Linux 命令大全Linux Command Collection

Other Extensions