我们在使用Linux的时候在一些特定的情况下我们需要查询和设置硬盘信息,可以通过hdparm命令来完成我们的需求,接下来www.gui2000.com为大家详细的介绍一下Linux显示与设定硬盘参数,有需要的小伙伴可以参考一下:
1、介绍:
hdparm命令用于检测,显示与设定IDE或SCSI硬盘的参数。
2、语法:
hdparm [options] [device ...]
3、相关参数:
参数 | 描述 |
---|---|
-a | 设定读取文件时,预先存入块区的分区数 |
-A | 启动或关闭读取文件时的快取功能<0或1> |
-b | Get/set bus state (0 == off, 1 == on, 2 == tristate) |
-B | Set Advanced Power Management setting (1-255) |
-c | Get/set IDE 32-bit IO setting |
-C | 检测IDE硬盘的电源管理模式。 |
-d | 设定磁盘的DMA模式<0或1> |
-D | Enable/disable drive defect management |
-E | Set cd/dvd drive speed |
-f | 将内存缓冲区的数据写入硬盘,并清空缓冲区 |
-F | Flush drive write cache |
-g | 显示硬盘的磁轨,磁头,磁区等参数 |
-h | 显示帮助。 |
-H | Read temperature from drive (Hitachi only) |
-i | 显示硬盘的硬件规格信息,这些信息是在开机时由硬盘本身所提供。 |
-I | 直接读取硬盘所提供的硬件规格信息 |
-J | Get/set Western DIgital "Idle3" timeout for a WDC "Green" drive (DANGEROUS) |
-k | Get/set keep_settings_over_reset flag (0/1) |
-K | Set drive keep_features_over_reset flag (0/1) |
-L | Set drive doorlock (0/1) (removable harddisks only) |
-m | Get/set multiple sector count |
-M | Get/set acoustic management (0-254, 128: quiet, 254: fast) |
-n | Get/set ignore-write-errors flag (0/1) |
-N | Get/set max visible number of sectors (HPA) (VERY DANGEROUS) |
-p | Set PIO mode on IDE interface chipset (0,1,2,3,4,...) |
-P | Set drive prefetch count |
-q | 在执行后续的参数时,不在屏幕上显示任何信息。 |
-Q | Get/set DMA queue_depth (if supported) |
-r | Get/set device readonly flag (DANGEROUS to set) |
-R | Get/set device write-read-verify flag |
-s | Set power-up in standby flag (0/1) (DANGEROUS) |
-S | Set standby (spindown) timeout |
-t | 评估硬盘的读取效率。 |
-T | 评估硬盘快取的读取效率。 |
-u | <0或1> 在硬盘存取时,允许其他中断要求同时执行 |
-U | Obsolete |
-v | 显示硬盘的相关设定。 |
-V | Display program version and exit immediately |
-w | Perform device reset (DANGEROUS) |
-W | Get/set drive write-caching flag (0/1) |
-x | Obsolete |
-X | 设定硬盘的传输模式 |
-y | 使IDE硬盘进入省电模式。 |
-Y | 使IDE硬盘进入睡眠模式。 |
-z | Re-read partition table |
-Z | 关闭某些Seagate硬盘的自动省电功能。 |
4、相关实例:
(1)、显示硬盘的相关设置
[[email protected] ~]# hdparm /dev/sda /dev/sda: SG_IO: bad/missing sense data, sb[]: 70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 multcount = 0 (off) readonly = 0 (off) readahead = 8192 (on) geometry = 13054/255/63, sectors = 209715200, start = 0
(2)、显示硬盘的柱面、磁头、扇区数
[[email protected] ~]# hdparm -g /dev/sda /dev/sda: geometry = 13054/255/63, sectors = 209715200, start =
(3)、评估硬盘的读取效率
[[email protected] ~]# hdparm -t /dev/sda /dev/sda: Timing buffered disk reads: 1238 MB in 3.00 seconds = 412.06 MB/sec
(4)、直接读取硬盘所提供的硬件规格信息
[[email protected] ~]# hdparm -X /dev/sda /dev/sda: setting xfermode to 0 (default PIO mode) SG_IO: bad/missing sense data, sb[]: 70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
(5)、显示硬盘的相关设定
[[email protected] ~]# hdparm -v /dev/sda /dev/sda: SG_IO: bad/missing sense data, sb[]: 70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 multcount = 0 (off) readonly = 0 (off) readahead = 8192 (on) geometry = 13054/255/63, sectors = 209715200, start = 0
以上就是www.gui2000.com为大家介绍的关于hdparm命令显示与设定硬盘参数的全部内容了,希望对大家有所帮助,了解更多相关文章请关注www.gui2000.com网!