关于linux下查看硬盘的转速也并没有一个统一的非常好用的工具 ,很多方法都是查看到disk 的型号再去网上查找转速或者利用OEM厂商提供的阵列查看工具去获取。我在网上查找了很久后,找到了一款对SCSI 硬盘比较通用的工具包 sg3_utils package 。
在centos 6的源直接带有,可以通过
yum -y install sg3_utils
安装 。也可以直接去官网下载rpm包、deb包或源码包进行安装 。该工具包包含的工具文件比较多,如下:
[root@localhost ~]# rpm -ql sg3_utils
/usr/bin/rescan-scsi-bus.sh
/usr/bin/scsi-rescan
/usr/bin/sg_copy_results
/usr/bin/sg_dd
/usr/bin/sg_emc_trespass
/usr/bin/sg_format
/usr/bin/sg_get_config
/usr/bin/sg_get_lba_status
/usr/bin/sg_ident
/usr/bin/sg_inq
/usr/bin/sg_logs
/usr/bin/sg_luns
/usr/bin/sg_map
/usr/bin/sg_map26
/usr/bin/sg_modes
/usr/bin/sg_opcodes
/usr/bin/sg_persist
/usr/bin/sg_prevent
/usr/bin/sg_raw
/usr/bin/sg_rbuf
/usr/bin/sg_rdac
/usr/bin/sg_read
/usr/bin/sg_read_block_limits
/usr/bin/sg_read_buffer
/usr/bin/sg_read_long
/usr/bin/sg_readcap
/usr/bin/sg_reassign
/usr/bin/sg_requests
/usr/bin/sg_reset
/usr/bin/sg_rmsn
/usr/bin/sg_rtpg
/usr/bin/sg_safte
/usr/bin/sg_sat_identify
/usr/bin/sg_sat_phy_event
/usr/bin/sg_sat_set_features
/usr/bin/sg_scan
/usr/bin/sg_senddiag
/usr/bin/sg_ses
/usr/bin/sg_start
/usr/bin/sg_stpg
/usr/bin/sg_sync
/usr/bin/sg_test_rwbuf
/usr/bin/sg_turs
/usr/bin/sg_unmap
/usr/bin/sg_verify
/usr/bin/sg_vpd
/usr/bin/sg_wr_mode
/usr/bin/sg_write_buffer
/usr/bin/sg_write_long
/usr/bin/sg_write_same
/usr/bin/sg_xcopy
/usr/bin/sginfo
/usr/bin/sgm_dd
/usr/bin/sgp_dd
/usr/share/doc/sg3_utils-1.28
/usr/share/doc/sg3_utils-1.28/COPYING
/usr/share/doc/sg3_utils-1.28/COVERAGE
/usr/share/doc/sg3_utils-1.28/CREDITS
/usr/share/doc/sg3_utils-1.28/ChangeLog
/usr/share/doc/sg3_utils-1.28/README
/usr/share/doc/sg3_utils-1.28/README.sg_start
/usr/share/man/man8/scsi_readcap.8.gz
/usr/share/man/man8/scsi_ready.8.gz
/usr/share/man/man8/scsi_start.8.gz
/usr/share/man/man8/scsi_stop.8.gz
/usr/share/man/man8/sg3_utils.8.gz
/usr/share/man/man8/sg_copy_results.8.gz
/usr/share/man/man8/sg_dd.8.gz
/usr/share/man/man8/sg_emc_trespass.8.gz
/usr/share/man/man8/sg_format.8.gz
/usr/share/man/man8/sg_get_config.8.gz
/usr/share/man/man8/sg_get_lba_status.8.gz
/usr/share/man/man8/sg_ident.8.gz
/usr/share/man/man8/sg_inq.8.gz
/usr/share/man/man8/sg_logs.8.gz
/usr/share/man/man8/sg_luns.8.gz
/usr/share/man/man8/sg_map.8.gz
/usr/share/man/man8/sg_map26.8.gz
/usr/share/man/man8/sg_modes.8.gz
/usr/share/man/man8/sg_opcodes.8.gz
/usr/share/man/man8/sg_persist.8.gz
/usr/share/man/man8/sg_prevent.8.gz
/usr/share/man/man8/sg_raw.8.gz
/usr/share/man/man8/sg_rbuf.8.gz
/usr/share/man/man8/sg_rdac.8.gz
/usr/share/man/man8/sg_read.8.gz
/usr/share/man/man8/sg_read_block_limits.8.gz
/usr/share/man/man8/sg_read_buffer.8.gz
/usr/share/man/man8/sg_read_long.8.gz
/usr/share/man/man8/sg_readcap.8.gz
/usr/share/man/man8/sg_reassign.8.gz
/usr/share/man/man8/sg_requests.8.gz
/usr/share/man/man8/sg_reset.8.gz
/usr/share/man/man8/sg_rmsn.8.gz
/usr/share/man/man8/sg_rtpg.8.gz
/usr/share/man/man8/sg_safte.8.gz
/usr/share/man/man8/sg_sat_identify.8.gz
/usr/share/man/man8/sg_sat_phy_event.8.gz
/usr/share/man/man8/sg_sat_set_features.8.gz
/usr/share/man/man8/sg_scan.8.gz
/usr/share/man/man8/sg_senddiag.8.gz
/usr/share/man/man8/sg_ses.8.gz
/usr/share/man/man8/sg_start.8.gz
/usr/share/man/man8/sg_stpg.8.gz
/usr/share/man/man8/sg_sync.8.gz
/usr/share/man/man8/sg_test_rwbuf.8.gz
/usr/share/man/man8/sg_turs.8.gz
/usr/share/man/man8/sg_unmap.8.gz
/usr/share/man/man8/sg_verify.8.gz
/usr/share/man/man8/sg_vpd.8.gz
/usr/share/man/man8/sg_wr_mode.8.gz
/usr/share/man/man8/sg_write_buffer.8.gz
/usr/share/man/man8/sg_write_long.8.gz
/usr/share/man/man8/sg_write_same.8.gz
/usr/share/man/man8/sg_xcopy.8.gz
/usr/share/man/man8/sginfo.8.gz
/usr/share/man/man8/sgm_dd.8.gz
/usr/share/man/man8/sgp_dd.8.gz
查看硬盘的转速的方法也有两种,一种是通过sginfo工作,一种是通过sg_vpd工具。
[root@localhost ~]# sginfo -g /dev/sda
Rigid Disk Geometry mode page (0x4)
-----------------------------------
Number of cylinders 153352
Number of heads 3
Starting cyl. write precomp 0
Starting cyl. reduced current 0
Device step rate 0
Landing Zone Cylinder 0
RPL 0
Rotational Offset 0
Rotational Rate 15000
[root@localhost ~]#
[root@localhost ~]# sginfo -g /dev/sdb
Rigid Disk Geometry mode page (0x4)
-----------------------------------
Number of cylinders 249000
Number of heads 4
Starting cyl. write precomp 0
Starting cyl. reduced current 0
Device step rate 0
Landing Zone Cylinder 0
RPL 0
Rotational Offset 0
Rotational Rate 7202
上面最后一行的结果就是转速,15000转,7202转 。
官方上也有对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 设备。
最后编辑:2016-09-20作者:劳福喜
这个作者貌似有点懒,什么都没有留下。