linux用smartctl看硬盘运行了多少小时

2013-02-03

1、什么是S.M.A.R.T.
SMART是一种磁盘自我分析检测技术,早在90年代末就基本得到了普及每一块硬盘(包括IDE、SCSI)在运行的时候,都会将自身的若干参数记录下来这些参数包括型号、容量、温度、密度、扇区、寻道时间、传输、误码率等.

运行了8万小时硬盘,你还敢用吗?(一年有多少小时:365x24=8760小时)

2、启用SMART

/etc/init.d/smartd start

或者

smartctl --smart=on --offlineauto=on --saveauto=on /dev/sda

3、硬盘是否打开了SMART支持
smartctl -i /dev/sda

4、查看硬盘的健康状况:
smartctl -H /dev/sda

5、详细的参数:
smartctl -A /dev/sdb

6、更详细的参数:
Examples (for first drive):
smartctl -i sda Show identify information
smartctl -H sda Show SMART health status
smartctl -c sda Show SMART capabilities
smartctl -A sda Show SMART attributes
smartctl -l error sda Show error log
smartctl -l selftest sda Show self-test log
smartctl -a sda Show all of the above
smartctl -t short sda Start short self test
smartctl -t long sda Start long self test
Use "sdb", "sdc", ... for second, third, ... drive.
See man page (smartctl.8.*) for further info.

smartctl -a /dev/sdb
smartctl -a -d ata /dev/sdb
smartctl -a -d 3ware,0 /dev/sda
smartctl -d scsi -A /dev/sda
smartctl -d sat --all /dev/sg1 -H

For SAS disk use the following syntax:
# smartctl -d scsi --all /dev/sgX
# smartctl -d scsi --all /dev/sg1
# smartctl -d scsi --all /dev/sg1 -H

smartctl -d scsi --all /dev/sg0 -H
smartctl -a -A /dev/sg0 -H

7、显示硬盘错误汇总
smartctl -l error /dev/sda

8、测试硬盘读写速度命令:
hdparm -t /dev/sda
hdparm -tT –direct /dev/sda1

dd bs=1M count=128 if=/dev/zero of=test conv=fdatasync

dd if=/dev/zero of=/root/1Gb.file bs=1024 count=1000000

9、raid0两块sas硬盘
dmesg|grep raid
[ 2.245530] megaraid_sas 0000:01:00.0: Controller type: iMR
fdisk -l
smartctl -a -d megaraid,0 /dev/sda
smartctl -a -d megaraid,1 /dev/sda

10、smartctl --scan
/dev/sda -d scsi # /dev/sda, SCSI device
/dev/sdb -d scsi # /dev/sdb, SCSI device
/dev/sdc -d scsi # /dev/sdc, SCSI device
/dev/sdd -d scsi # /dev/sdd, SCSI device
/dev/sde -d scsi # /dev/sde, SCSI device
/dev/sdf -d scsi # /dev/sdf, SCSI device
/dev/bus/0 -d megaraid,8 # /dev/bus/0 [megaraid_disk_08], SCSI device
/dev/bus/0 -d megaraid,9 # /dev/bus/0 [megaraid_disk_09], SCSI device
/dev/bus/0 -d megaraid,10 # /dev/bus/0 [megaraid_disk_10], SCSI device
/dev/bus/0 -d megaraid,11 # /dev/bus/0 [megaraid_disk_11], SCSI device
/dev/bus/0 -d megaraid,12 # /dev/bus/0 [megaraid_disk_12], SCSI device
/dev/bus/0 -d megaraid,13 # /dev/bus/0 [megaraid_disk_13], SCSI device
/dev/bus/0 -d megaraid,14 # /dev/bus/0 [megaraid_disk_14], SCSI device
smartctl -i -d 'megaraid,10' -A /dev/sda
smartctl -d 'megaraid,11' -i /dev/sdb
smartctl 7.1 2020-04-05 r5049 [x86_64-linux-4.18.0-408.el8.x86_64] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Vendor: TOSHIBA
Product: MG06SCA800EY
Revision: EH0D
Compliance: SPC-4
User Capacity: 8,001,563,222,016 bytes [8.00 TB]
Logical block size: 512 bytes
Physical block size: 4096 bytes
Formatted with type 2 protection
8 bytes of protection information per logical block
Rotation Rate: 7200 rpm
Form Factor: 3.5 inches
Logical Unit id: 0x5000039b5821fc0d
Serial number: Z190A082F1GF
Device type: disk
Transport protocol: SAS (SPL-3)
Local Time is: Sun Feb 26 03:42:31 2023 CST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
Temperature Warning: Disabled or Not Supported

分类:Linux | 标签: |

相关日志

评论被关闭!