View the hard disk status of the centos Server
If HDTune is available in windows, you can view the disk status to prevent the disk from being crashed. In CentOS, SMART (Self-Monitoring, Analysis and Reporting Technology System) also checks the disk status.
Http://www.smartmontools.org/
The following uses the dellR720 server as an example./dev/sda is a 1 TB scsi interface hard disk, And/dev/sdd is a RAID 5 made of three disks.
# Df-h # view the disk name
# Dmesg | grep sdd # view the disk info in the boot Information
Sd 0: 2: 0: 0: [sdd] Attached SCSI disk
# Hdparm-I/dev/sda # view disk hardware information, enable functions, and so on. The information is particularly detailed.
Use smart to view the disk status:
# Yuminstallsmartmontools // install SMART
# Smartctl-H/dev/sdd // view disk health status
smartctl5.432012-06-30r3573[x86_64-linux-3.10.56-11.el6.centos.alt.x86_64](
local
build)
Copyright(C)2002-12byBruceAllen,
http:
//smartmontools
.sourceforge.net
SMARTHealthStatus:OK
# Smartctl-A/dev/sda or smartctl -- all/dev/sda # smart Information of the hard disk
#smartctl-a/dev/sdd
smartctl5.432012-06-30r3573[x86_64-linux-3.10.56-11.el6.centos.alt.x86_64](
local
build)
Copyright(C)2002-12byBruceAllen,
http:
//smartmontools
.sourceforge.net
Vendor:DELL
Product:PERCH310
Revision:2.12
UserCapacity:598,879,502,336bytes[598GB]
Logicalblocksize:512bytes
LogicalUnit
id
:
Serialnumber:
Device
type
:disk
LocalTimeis:WedJan1415:37:392015CST
DevicedoesnotsupportSMART
ErrorCounterloggingnotsupported
DevicedoesnotsupportSelfTestlogging
The message "Device does not support SMART" is displayed. view the information as follows:
View the status of the first disk in raid5
# Smartctl-a-d megaraid, 0/dev/sdd
You can also view the status of the second and third disks to speed up the nagios and zabbix alarms based on your own monitoring conditions.
# Smartctl-a-d megaraid, 1/dev/sdd
# Smartctl-a-d megaraid, 2/dev/sdd
In addition, the usage of smartctl is described in detail:
#smartctl-h
Usage:smartctl[options]device
============================================SHOWINFORMATIONOPTIONS=====
-h,--help,--usage
Displaythishelpand
exit
-V,--version,--copyright,--license
Printlicense,copyright,andversioninformationand
exit
-i,--info
Showidentityinformation
for
device
-gNAME,--get=NAME
Getdevicesetting:all,aam,apm,lookahead,security,wcache
-a,--all
ShowallSMARTinformation
for
device
-x,--xall
Showallinformation
for
device
--scan
Scan
for
devices
--scan-
open
Scan
for
devicesandtryto
open
eachdevice
==================================SMARTCTLRUN-TIMEBEHAVIOROPTIONS=====
-qTYPE,--quietmode=TYPE(ATA)
Setsmartctlquietmodetooneof:errorsonly,silent,noserial
-dTYPE,--device=TYPE
Specifydevice
type
tooneof:ata,scsi,sat[,auto][,N][+TYPE],
usbcypress[,X],usbjmicron[,x][,N],usbsunplus,marvell,areca,N
/E
,
3ware,N,hpt,L
/M/N
,megaraid,N,cciss,N,auto,
test
-TTYPE,--tolerance=TYPE(ATA)
Tolerance:normal,conservative,permissive,verypermissive
-bTYPE,--badsum=TYPE(ATA)
Setactiononbadchecksumtooneof:warn,
exit
,ignore
-rTYPE,--report=TYPE
Reporttransactions(see
man
page)
-nMODE,--nocheck=MODE(ATA)
Nocheck
if
:never,
sleep
,standby,idle(see
man
page)
==============================DEVICEFEATUREENABLE
/DISABLE
COMMANDS=====
-sVALUE,--smart=VALUE
Enable
/disable
SMARTondevice(on
/off
)
-oVALUE,--offlineauto=VALUE(ATA)
Enable
/disable
automaticofflinetestingondevice(on
/off
)
-SVALUE,--saveauto=VALUE(ATA)
Enable
/disable
Attributeautosaveondevice(on
/off
)
-sNAME[,VALUE],--
set
=NAME[,VALUE]
Enable
/disable/change
devicesetting:aam,[N|off],apm,[N|off],
lookahead,[on|off],security-freeze,standby,[N|off|now],
wcache,[on|off]
=======================================READANDDISPLAYDATAOPTIONS=====
-H,--health
ShowdeviceSMARThealthstatus
-c,--capabilities(ATA)
ShowdeviceSMARTcapabilities
-A,--attributes
ShowdeviceSMARTvendor-specificAttributesandvalues
-fFORMAT,--
format
=FORMAT(ATA)
Setoutput
format
for
attributes:old,brief,hex[,
id
|val]
-lTYPE,--log=TYPE
Showdevicelog.TYPE:error,selftest,selective,directory[,g|s],
xerror[,N][,error],xselftest[,N][,selftest],
background,sasphy[,reset],sataphy[,reset],
scttemp[sts,hist],scttempint,N[,p],
scterc[,N,M],devstat[,N],ssd,
gplog,N[,RANGE],smartlog,N[,RANGE]
-
v
N,OPTION,--vendorattribute=N,OPTION(ATA)
SetdisplayOPTION
for
vendorAttributeN(see
man
page)
-FTYPE,--firmwarebug=TYPE(ATA)
Usefirmwarebugworkaround:none,samsung,samsung2,
samsung3,swapid
-PTYPE,--presets=TYPE(ATA)
Drive-specificpresets:use,ignore,show,showall
-B[+]FILE,--drivedb=[+]FILE(ATA)
Readandreplace[add]drivedatabasefromFILE
[defaultis+
/etc/smart_drivedb
.h
and
then
/usr/share/smartmontools/drivedb
.h]
============================================DEVICESELF-TESTOPTIONS=====
-tTEST,--
test
=TEST
Run
test
.TEST:offline,short,long,conveyance,force,vendor,N,
select
,M-N,pending,N,afterselect,[on|off]
-C,--captive
Do
test
in
captivemode(alongwith-t)
-X,--abort
Abortanynon-captive
test
ondevice
===================================================SMARTCTLEXAMPLES=====
smartctl--all
/dev/hda
(PrintsallSMARTinformation)
smartctl--smart=on--offlineauto=on--saveauto=on
/dev/hda
(EnablesSMARTonfirstdisk)
smartctl--
test
=long
/dev/hda
(Executesextendeddiskself-
test
)
smartctl--attributes--log=selftest--quietmode=errorsonly
/dev/hda
(PrintsSelf-Test&Attributeerrors)
smartctl--all--device=3ware,2
/dev/sda
smartctl--all--device=3ware,2
/dev/twe0
smartctl--all--device=3ware,2
/dev/twa0
smartctl--all--device=3ware,2
/dev/twl0
(PrintsallSMARTinfo
for
3rdATAdiskon3wareRAIDcontroller)
smartctl--all--device=hpt,1
/1/3
/dev/sda
(PrintsallSMARTinfo
for
theSATAdiskattachedtothe3rdPMPort
ofthe1stchannelonthe1stHighPointRAIDcontroller)
smartctl--all--device=areca,3
/1
/dev/sg2
(PrintsallSMARTinfo
for
3rdATAdiskofthe1stenclosure
onArecaRAIDcontroller)
This article from the "Jin Ge tie Ma Xing feiyan" blog, please be sure to keep this source http://bbotte.blog.51cto.com/6205307/1603985