linux下查看硬盘的转速
关于linux下查看硬盘的转速也并没有一个统一的非常好用的工具 ,很多方法都是查看到disk 的型号再去网上查找转速或者利用OEM厂商提供的阵列查看工具去获取。我在网上查找了很久后,找到了一款对SCSI 硬盘比较通用的工具包 sg3_utils package 。
在centos 6的源直接带有,可以通过yum -y install sg3_utils 安装 。也可以直接去官网下载rpm包、deb包或源码包进行安装 。该工具包包含的工具文件比较多,如下:
1[root@361way tmp]# rpm -ql sg3_utils
2/usr/bin/rescan-scsi-bus.sh
3/usr/bin/scsi-rescan
4/usr/bin/sg_dd
5/usr/bin/sg_emc_trespass
6/usr/bin/sg_format
7/usr/bin/sg_get_config
8/usr/bin/sg_ident
9/usr/bin/sg_inq
10/usr/bin/sg_logs
11/usr/bin/sg_luns
12/usr/bin/sg_map
13/usr/bin/sg_map26
14/usr/bin/sg_modes
15/usr/bin/sg_opcodes
16/usr/bin/sg_persist
17/usr/bin/sg_prevent
18/usr/bin/sg_raw
19/usr/bin/sg_rbuf
20/usr/bin/sg_rdac
21/usr/bin/sg_read
22/usr/bin/sg_read_buffer
23/usr/bin/sg_read_long
24/usr/bin/sg_readcap
25/usr/bin/sg_reassign
26/usr/bin/sg_requests
27/usr/bin/sg_reset
28/usr/bin/sg_rmsn
29/usr/bin/sg_rtpg
30/usr/bin/sg_safte
31/usr/bin/sg_sat_identify
32/usr/bin/sg_sat_set_features
33/usr/bin/sg_scan
34/usr/bin/sg_senddiag
35/usr/bin/sg_ses
36/usr/bin/sg_start
37/usr/bin/sg_stpg
38/usr/bin/sg_sync
39/usr/bin/sg_test_rwbuf
40/usr/bin/sg_turs
41/usr/bin/sg_verify
42/usr/bin/sg_vpd
43/usr/bin/sg_wr_mode
44/usr/bin/sg_write_buffer
45/usr/bin/sg_write_long
46/usr/bin/sginfo
47/usr/bin/sgm_dd
48/usr/bin/sgp_dd
查看硬盘的转速的方法也有两种,一种是通过sginfo工作,一种是通过sg_vpd工具。
1[root@361way tmp]# sginfo -g /dev/cciss/c0d0
2Rigid Disk Geometry mode page (0x4)
3-----------------------------------
4Number of cylinders 65535
5Number of heads 255
6Starting cyl. write precomp 65535
7Starting cyl. reduced current 65535
8Device step rate 0
9Landing Zone Cylinder 0
10RPL 0
11Rotational Offset 0
12Rotational Rate 15000
上面最后一行的结果就是转速,15000转 。使用sg_vpd的方法相对复杂:
1# sg_vpd /dev/sg8 --page=0×89
2ATA information VPD page:
3 SAT Vendor identification: LSI
4 SAT Product identification: LSI SATL
5 SAT Product revision level: 0008
6 ATA command IDENTIFY DEVICE response summary:
7 model: ST31000340NS
8 serial number: 9QJ4VPL1
9 firmware revision: SN06
10linux-suse11p1:~ # sg_vpd /dev/sg8 --page=0xb1
11Block device characteristics VPD page (SBC):
12 Nominal rotation rate: 7200 rpm
13 Nominal form factor not reported
上面Nominal rotation rate后面的值就是转速,为7200转 。使用该命令时需要知道page后面使用的值,需要使用sg_vpd -e参数来获取。在使用非scsi硬盘时,执行后的结果如下:
1[root@361way ~]# sginfo -g /dev/hda
2A device name that understands SCSI commands is required
3Couldn't find sg device corresponding to /dev/hda
官方上也有对sg3_utils包的一段说明:
The sg3_utils package contains utilities that send SCSI commands to devices. As well as devices on transports traditionally associated with SCSI (e.g. Fibre Channel (FCP), Serial Attached SCSI (SAS) and the SCSI Parallel Interface(SPI)) many other devices use SCSI command sets. ATAPI cd/dvd drives and SATA disks that connect via a translation layer or a bridge device are examples of devices that use SCSI command sets.
上面直接就说明只适用于scsi 设备。
捐赠本站(Donate)
如您感觉文章有用,可扫码捐赠本站!(If the article useful, you can scan the QR code to donate))
- Author: shisekong
- Link: https://blog.361way.com/scsi-disk-rotational-rate/3440.html
- License: This work is under a 知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议. Kindly fulfill the requirements of the aforementioned License when adapting or creating a derivative of this work.