hdparm 命令
该命令用来获取或设置SATA/IDE设备的参数。实际上hdparm是linux中的一个用户层程序,查看源码会发现这个命令就是向磁盘发送一些ioctl命令。但是注意了,既然可以获取也可以设置,所以使用这个命令的时候务必要小心。当然我们只是为了获取查看硬盘信息,故不会对硬盘及系统造成什么危害。通常会配合 -i 或 -I(大写的i) 选项来取得硬盘的硬件信息。例如序列码等等啊~用法如下: hdparm -i /dev/sdb
例如输出如下:
[root@localhost grub]# hdparm -i /dev/sdb
/dev/sdb:
Model=WDC, FwRev=01.01V02, SerialNo=WD-WCAW36379667
Config={ HardSect NotMFM HdSw>15uSec SpinMotCtl Fixed DTR>5Mbs FmtGapReq }
RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=50
BuffType=unknown, BuffSize=unknown, MaxMultSect=16, MultSect=off
CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=1953525168
IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
PIO modes: pio0 pio3 pio4
DMA modes: mdma0 mdma1 mdma2
UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6
AdvancedPM=yes: unknown setting WriteCache=enabled
Drive conforms to: Unspecified: ATA/ATAPI-1,2,3,4,5,6,7
* signifies the current active mode
smartctl 命令
这个一个用于控制和监控支持smart技术的硬盘的命令。通常配合 -a 选项我们可以查看到比较详尽的硬盘信息(比如序列号、硬盘容量、已运行时间、硬盘健康状况等)。用法如下:
smartctl -a /dev/sda
部分输出如下:
=== START OF INFORMATION SECTION ===
Model Family: Western Digital RE4 Serial ATA
Device Model: WDC WD1003FBYX-01Y7B1
Serial Number: WD-WCAW36379667
LU WWN Device Id: 5 0014ee 2b38e9ad1
Firmware Version: 01.01V02
User Capacity: 1,000,204,886,016 bytes [1.00 TB]
Sector Size: 512 bytes logical/physical
Device is: In smartctl database [for details use: -P show]
ATA Version is: 8
ATA Standard is: Exact ATA specification draft version not indicated
Local Time is: Tue Apr 8 20:22:16 2014 CST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
General SMART Values:
Offline data collection status: (0x82) Offline data collection activity
was completed without error.