无论是生产服务器还是日常使用的家用电脑,长期使用都会消耗磁盘,因此需要定期检查并确认是否需要更换磁盘以确保磁盘的健康。 众所周知,在Windows系统上,许多第三方软件都可以实现磁盘检测,但在Linux系统上,实际上有默认的检测工具SMART。 要将SMART与主板BIOS上支持的功能配合使用,SMART必须首先进入主板BIOS设置并启动相关设置。 这个项目技术在实际的90年代被广泛应用。 SMART会记录模型、容量、温度、密度、扇区、寻道时间、传输和错误率等详细信息,长期使用会改变这些参数,因此可以使用SMART来确定磁盘是否健康。
[root@test data]# fdisk -l#请检查磁盘信息
[ root @ test data ] # smartctl-I/dev/sda
smartctl version 5.38 [ x86 _ 64-red hat-Linux-GNU ] copyright (c ) 2002-8 Bruce Allen
home page is http://smartmontools.source forge.net /
===startofinformationsection===
dvice model : wd CWD 5000 aakx-08 u6aa 0
serial number 3360 wd-wmc2e0j 27j 46
Firmware Version: 19.01H19
用户容量:500、107、862、016字节
device is : notinsmartctldatabase [ fordetailsuse :-pshow all ]
ATA Version is: 8
atastandardis : xactataspecificationdraftversionnotindicated
local time is : mon aug 1521:53360512016 CST
smartsupportis :可用设备hassmartcapability。
对于Disabled,SMART support is: Enabled#值未启动,必须手动选中
[ root @ test data ] # smartctlsmart=onoffline auto=onsave auto=on/dev/sda
[ root @ test data ] # smartctl-h/dev/sda
smartctl version 5.38 [ x86 _ 64-red hat-Linux-GNU ] copyright (c ) 2002-8 Bruce Allen
home page is http://smartmontools.source forge.net /
===startofreadsmartdatasection==
smart overall-health self-assessment test result : passed #值表示磁盘良好,如果为Failure,则将其替换
在那里,可以打开Linux上的SMART功能,对磁盘进行健康检查。 在这里,可以把这个值加到监视检查中。 需要注意的是,Windows没有内置与SMART相关的工具,只能通过第三方工具进行检测,虚拟机上的硬盘也不支持磁盘检测