查看硬盘健康状态

1,服务器配置

DELL T630
9(4TB 7.2K RPM NLSAS 6Gbps 3.5英寸 热插拔硬盘,13G)
3 (1.2TB 10K RPM SAS 6Gbps 2.5英寸 热插拔硬盘,置于3.5英寸HYB托架,13G)

2,依次查看第N(N=0,1,…,11)块盘的健康状态

sudo smartctl -d megaraid,N -H /dev/sdb
如果健康,输出为
SMART Health Status: OK
#显示某块硬盘的所有信息
sudo smartctl -d megaraid,N -all /dev/sdb
(手动将N换成0到11,上述方法貌似有点傻。。。)

3,下面来仔细研究一下smartctl的功能,这个命令是很多Linux系统自带的

Usage: smartctl [options] device

============================================ SHOW INFORMATION OPTIONS =====

-h, --help, --usage
Display this help and exit

-V, --version, --copyright, --license
Print license, copyright, and version information and exit

-i, --info
Show identity information for device

-g NAME, --get=NAME
Get device setting: all, aam, apm, lookahead, security, wcache

-a, --all
Show all SMART information for device

-x, --xall
Show all information for device
–scan
Scan for devices

–scan-open
Scan for devices and try to open each device

================================== SMARTCTL RUN-TIME BEHAVIOR OPTIONS =====

-q TYPE, --quietmode=TYPE (ATA)
Set smartctl quiet mode to one of: errorsonly, silent, noserial

-d TYPE, --device=TYPE
Specify device type to one of: 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

-T TYPE, --tolerance=TYPE (ATA)
Tolerance: normal, conservative, permissive, verypermissive

-b TYPE, --badsum=TYPE (ATA)
Set action on bad checksum to one of: warn, exit, ignore

-r TYPE, --report=TYPE
Report transactions (see man page)

-n MODE, --nocheck=MODE (ATA)
No check if: never, sleep, standby, idle (see man page)

============================== DEVICE FEATURE ENABLE/DISABLE COMMANDS =====

-s VALUE, --smart=VALUE
Enable/disable SMART on device (on/off)

-o VALUE, --offlineauto=VALUE (ATA)
Enable/disable automatic offline testing on device (on/off)

-S VALUE, --saveauto=VALUE (ATA)
Enable/disable Attribute autosave on device (on/off)

-s NAME[,VALUE], --set=NAME[,VALUE]
Enable/disable/change device setting: aam,[N|off], apm,[N|off],
lookahead,[on|off], security-freeze, standby,[N|off|now],
wcache,[on|off]
======================================= READ AND DISPLAY DATA OPTIONS =====

-H, --health
Show device SMART health status

-c, --capabilities (ATA)
Show device SMART capabilities

-A, --attributes
Show device SMART vendor-specific Attributes and values

-f FORMAT, --format=FORMAT (ATA)
Set output format for attributes: old, brief, hex[,id|val]

-l TYPE, --log=TYPE
Show device log. 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)
Set display OPTION for vendor Attribute N (see man page)

-F TYPE, --firmwarebug=TYPE (ATA)
Use firmware bug workaround: none, samsung, samsung2,
samsung3, swapid

-P TYPE, --presets=TYPE (ATA)
Drive-specific presets: use, ignore, show, showall

-B [+]FILE, --drivedb=[+]FILE (ATA)
Read and replace [add] drive database from FILE
[default is +/etc/smart_drivedb.h
and then /usr/share/smartmontools/drivedb.h]
============================================ DEVICE SELF-TEST OPTIONS =====

-t TEST, --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 captive mode (along with -t)

-X, --abort
Abort any non-captive test on device

=================================================== SMARTCTL EXAMPLES =====

smartctl --all /dev/hda (Prints all SMART information)

smartctl --smart=on --offlineauto=on --saveauto=on /dev/hda
(Enables SMART on first disk)

smartctl --test=long /dev/hda (Executes extended disk self-test)

smartctl --attributes --log=selftest --quietmode=errorsonly /dev/hda
(Prints Self-Test & Attribute errors)
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
(Prints all SMART info for 3rd ATA disk on 3ware RAID controller)
smartctl --all --device=hpt,1/1/3 /dev/sda
(Prints all SMART info for the SATA disk attached to the 3rd PMPort
of the 1st channel on the 1st HighPoint RAID controller)
smartctl --all --device=areca,3/1 /dev/sg2
(Prints all SMART info for 3rd ATA disk of the 1st enclosure
on Areca RAID controller)

5,本机器做过raid5,貌似没法批量查看,所以写个脚本来批量查看

perl -e ‘for ($i=0;$i<12;$i++) {print “the status of disk $i\n”;print `sudo smartctl -d megaraid,$i -H /dev/sdb`;}’

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值