Smartmontools,是一款开源的磁盘检测和控制工具,正好今天有接触到一款服务器想检查下这台服务器硬盘的通电时间用到这款工具,所以把这个工具的安装和简单应用记录下来,毕竟年纪大了脑子不是很好用。稍微折腾的用户在选择服务器检查硬盘健康状态,以及相关参数的时候会有所用到。
在Ubuntu下的安装:
sudo apt-get install smartmontools1
smartctl 命令格式
smartctl [options] device1
常用选项:
-h : 显示帮助信息
-V : 显示版本信息
-i : 显示设备的身份信息(SN 厂家等信息)
-a : 显示设备的全部SMART信息
-x : 显示设备的详细信息
-H : 查看硬盘健康状态123456
示例:
$ sudo smartctl -a /dev/sda
smartctl 5.41 2011-06-09 r3365 [i686-linux-3.2.0-29-generic-pae] (local build)
Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net
=== START OF INFORMATION SECTION ===
Device Model: VBOX HARDDISK
Serial Number: VB9cc1f7fa-596d5552
Firmware Version: 1.0
User Capacity: 42,949,672,960 bytes [42.9 GB]
Sector Size: 512 bytes logical/physical
Device is: Not in smartctl database [for details use: -P showall]
ATA Version is: 6
ATA Standard is: ATA/ATAPI-6 published, ANSI INCITS 361-2002
Local Time is: Fri Jul 24 11:57:33 2015 HKT
SMART support is: Unavailable - device lacks SMART capability.
以上结果是在虚拟机上运行的,虚拟机是不支持 SMART 技术的。但是还是取到了固件版本和SN123456789101112131415161718
另外一台机器,支持SMART技术,并开启了SMART的信息:
smartctl 6.2 2013-07-26 r3841 [i686-linux-3.16.0-30-generic] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Model Family: Hitachi/HGST Travelstar Z7K500
Device Model: HGST HTS725050A7E630
Serial Number: TF0500WJ2G3DDV
LU WWN Device Id: 5 000cca 7c5e298f7
Firmware Version: GH2OA420
User Capacity: 500,107,862,016 bytes [500 GB]
Sector Sizes: 512 bytes logical, 4096 bytes physical
Rotation Rate: 7200 rpm
Device is: In smartctl database [for details use: -P show]
ATA Version is: ATA8-ACS T13/1699-D revision 6
SATA Version is: SATA 2.6, 6.0 Gb/s (current: 3.0 Gb/s)
Local Time is: Fri Jul 24 12:00:18 2015 CST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
以上就是良许教程网为各位朋友分享的Linu系统相关内容。想要了解更多Linux相关知识记得关注公众号“良许Linux”,或扫描下方二维码进行关注,更多干货等着你 !