How to use the Linux hdparm command
Today, I would like to share with you the relevant knowledge of how to use the Linux hdparm command. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.
The Linux common command hdparm command provides a command line interface for reading and setting IDE or SCSI hard disk parameters.
Hdparm display and set the parameters of hard disk
Syntax hdparm (option) (parameter) option-a: set the number of partitions that are pre-stored in the block when reading the file, and if no option is added, the current setting is displayed;-A: turn on or off the cache function when reading the file;-c: set the IDE32 bit IUnip O mode;-C: detect the power management mode of the IDE hard disk;-d: set the DMA mode of the disk -f: write the data of the memory buffer to the hard disk and clear the buffer;-g: display the hard disk track, head, sector and other parameters;-h: display help;-I: display the hardware specification information of the hard disk, which is provided by the hard disk itself at boot;-I: directly read the hardware specification information provided by the hard disk;-k: keep the setting of the-dmu parameter when resetting the hard disk. -K: leave the setting of the-APSWXZ parameter when resetting the hard disk;-m: set the number of partitions accessed by multiple partitions of the hard disk;-n: ignore errors that occur when the hard disk is written;-p: set the PIO mode of the hard disk;-P: set the number of partitions cached inside the hard disk;-Q: no information is displayed on the screen when performing subsequent parameters;-r: set the read and write mode of the hard disk -S: set the wait time before the hard disk enters the power-saving mode;-t; evaluate the reading efficiency of the hard disk;-T: read efficiency of the Pinggu hard disk cache;-u: allow other interrupt requirements to be executed simultaneously when accessing the hard disk;-v: display the relevant settings of the hard disk;-w: set the write cache of the hard disk;-X: set the transfer mode of the hard disk;-y: put the IDE hard disk into power-saving mode. -Y: put the IDE hard drive into sleep mode;-Z: turn off the automatic power saving feature of some Seagate hard drives. Parameter device file: specify the device file name corresponding to the id driver.
An example displays 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 = 19457 [number of cylinders] / 255 [number of heads] / 63 [number of sectors], sectors = 312581808 [total number of sectors], start = 0 [number of starting sectors] ````shell displays the number of cylinders, heads and sectors of the hard disk: ```shell hdparm-g / dev/sda / dev/sda: geometry = 19457 [number of cylinders] / 255[ number of heads] / 63 [number of sectors] Sectors = 312581808 [total sectors], start = 0 [starting sectors] to test the read speed of the hard disk:
Hdparm-T / dev/sda / dev/sda: Timing cached reads: 4684 MB in 2.00 seconds = 2342.92 MB/sec Test the read speed of the hard disk cache:
Hdparm-T / dev/xvda / dev/xvda: Timing cached reads: 11154 MB in 1.98 seconds = 5633.44 MB/sec detect the power management mode of the hard drive:
Hdparm-C / dev/sda / dev/sda: drive state is: standby [Power Saving Mode] queries and sets the number of sectors for multiple sector access of the hard disk to improve the access efficiency of the hard disk:
Hdparm-m / dev/sda hdparm-m # parameter value is an integer value such as 8 / dev/sda attached: hard disk bad track repair method
Check: smartctl-l selftest / dev/sda uninstall: umount / dev/sda* repair: badblocks / dev/sda above is all the content of this article "how to use Linux hdparm commands". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.