linux下查看硬盘的转速

2011年8月16日 发表评论 阅读评论

关于linux下查看硬盘的转速也并没有一个统一的非常好用的工具 ,很多方法都是查看到disk 的型号再去网上查找转速或者利用OEM厂商提供的阵列查看工具去获取。我在网上查找了很久后,找到了一款对SCSI 硬盘比较通用的工具包 sg3_utils package

在centos 6的源直接带有,可以通过yum -y install sg3_utils 安装 。也可以直接去官网下载rpm包、deb包或源码包进行安装 。该工具包包含的工具文件比较多,如下:

[root@361way tmp]# rpm -ql sg3_utils
/usr/bin/rescan-scsi-bus.sh
/usr/bin/scsi-rescan
/usr/bin/sg_dd
/usr/bin/sg_emc_trespass
/usr/bin/sg_format
/usr/bin/sg_get_config
/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_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_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_verify
/usr/bin/sg_vpd
/usr/bin/sg_wr_mode
/usr/bin/sg_write_buffer
/usr/bin/sg_write_long
/usr/bin/sginfo
/usr/bin/sgm_dd
/usr/bin/sgp_dd

查看硬盘的转速的方法也有两种,一种是通过sginfo工作,一种是通过sg_vpd工具。

[root@361way tmp]# sginfo -g /dev/cciss/c0d0
Rigid Disk Geometry mode page (0x4)
-----------------------------------
Number of cylinders                65535
Number of heads                    255
Starting cyl. write precomp        65535
Starting cyl. reduced current      65535
Device step rate                   0
Landing Zone Cylinder              0
RPL                                0
Rotational Offset                  0
Rotational Rate                    15000

上面最后一行的结果就是转速,15000转 。使用sg_vpd的方法相对复杂:

# sg_vpd /dev/sg8 --page=0×89
ATA information VPD page:
 SAT Vendor identification: LSI
 SAT Product identification: LSI SATL
 SAT Product revision level: 0008
 ATA command IDENTIFY DEVICE response summary:
   model: ST31000340NS
   serial number:             9QJ4VPL1
   firmware revision: SN06
linux-suse11p1:~ # sg_vpd /dev/sg8 --page=0xb1
Block device characteristics VPD page (SBC):
 Nominal rotation rate: 7200 rpm
 Nominal form factor not reported

上面Nominal rotation rate后面的值就是转速,为7200转 。使用该命令时需要知道page后面使用的值,需要使用sg_vpd -e参数来获取。

在使用非scsi硬盘时,执行后的结果如下:

[root@361way ~]# sginfo -g /dev/hda
A device name that understands SCSI commands is required
Couldn'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 设备。 




本站的发展离不开您的资助,金额随意,欢迎来赏!

You can donate through PayPal.
My paypal id: itybku@139.com
Paypal page: https://www.paypal.me/361way

分类: 开源软件 标签:
  1. 本文目前尚无任何评论.
  1. 本文目前尚无任何 trackbacks 和 pingbacks.