1、安装smartmontools软件包
1 2 | apt-get install smartmontools # Debian/Ubuntu yum install smartmontools # RedHat/CentOS |
2、命令帮助
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | root@pve01:~ # smartctl --help smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.15.53-1-pve] ( local build) Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org 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 --identify[=[w][nvb]] Show words and bits from IDENTIFY DEVICE data (ATA) -g NAME, --get=NAME Get device setting: all, aam, apm, dsn, lookahead, security, wcache, rcache, wcreorder, wcache-sct -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 ===== -j, --json[=cgiosuvy] Print output in JSON or YAML format -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[+TYPE], nvme[,NSID], sat[,auto][,N][+TYPE], usbcypress[,X], usbjmicron[,p][,x][,N], usbprolific, usbsunplus, sntjmicron[,NSID], sntrealtek, intelliprop,N[+TYPE], jmb39x[-q],N[,sLBA][,force][+TYPE], jms56x,N[,sLBA][,force][+TYPE], marvell, areca,N /E , 3ware,N, hpt,L /M/N , megaraid,N, aacraid,H,L,ID, 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[,STATUS], --nocheck=MODE[,STATUS] (ATA, SCSI) 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], dsn,[on|off], lookahead,[on|off], security-freeze, standby,[N|off|now], wcache,[on|off], rcache,[on|off], wcreorder,[on|off[,p]], wcache-sct,[ata|on|off[,p]] ======================================= READ AND DISPLAY DATA OPTIONS ===== -H, --health Show device SMART health status -c, --capabilities (ATA, NVMe) 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], defects[,N], ssd, gplog,N[,RANGE], smartlog,N[,RANGE], nvmelog,N,SIZE - 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, nologdir, samsung, samsung2, samsung3, xerrorlba, 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 /var/lib/smartmontools/drivedb/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/sda (Prints all SMART information) smartctl --smart=on --offlineauto=on --saveauto=on /dev/sda (Enables SMART on first disk) smartctl -- test =long /dev/sda (Executes extended disk self- test ) smartctl --attributes --log=selftest --quietmode=errorsonly /dev/sda (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) |
3、查看服务器上的硬盘情况
1 2 3 4 5 6 7 8 | root@pve01:~ # smartctl --scan /dev/sda -d scsi # /dev/sda, SCSI device /dev/bus/0 -d megaraid,0 # /dev/bus/0 [megaraid_disk_00], SCSI device /dev/bus/0 -d megaraid,1 # /dev/bus/0 [megaraid_disk_01], SCSI device /dev/bus/0 -d megaraid,2 # /dev/bus/0 [megaraid_disk_02], SCSI device /dev/bus/0 -d megaraid,3 # /dev/bus/0 [megaraid_disk_03], SCSI device /dev/bus/0 -d megaraid,4 # /dev/bus/0 [megaraid_disk_04], SCSI device /dev/bus/0 -d megaraid,5 # /dev/bus/0 [megaraid_disk_05], SCSI device |
4、各种RAID控制器的参数
5、获取硬盘的各项参数情况
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | root@pve01:~ # smartctl -a -d megaraid,5 /dev/sda smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.15.53-1-pve] ( local build) Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org === START OF INFORMATION SECTION === Vendor: SEAGATE Product: ST2000NM0023 Revision: GS0A Compliance: SPC-4 User Capacity: 2,000,398,934,016 bytes [2.00 TB] Logical block size: 512 bytes LU is fully provisioned Rotation Rate: 7200 rpm Form Factor: 3.5 inches Logical Unit id : 0x5000c50057f7c51f Serial number: Z1X1KM2R Device type : disk Transport protocol: SAS (SPL-3) Local Time is: Mon Sep 11 10:55:37 2023 CST SMART support is: Available - device has SMART capability. SMART support is: Enabled Temperature Warning: Disabled or Not Supported === START OF READ SMART DATA SECTION === SMART Health Status: OK Current Drive Temperature: 44 C Drive Trip Temperature: 50 C Accumulated power on time , hours:minutes 17425:17 Manufactured in week 52 of year 2013 Specified cycle count over device lifetime: 10000 Accumulated start-stop cycles: 9 Specified load-unload count over device lifetime: 300000 Accumulated load-unload cycles: 35768 Elements in grown defect list: 0 Vendor (Seagate Cache) information Blocks sent to initiator = 2621212142 Blocks received from initiator = 2847 Blocks read from cache and sent to initiator = 3763 Number of read and write commands whose size <= segment size = 68359 Number of read and write commands whose size > segment size = 0 Vendor (Seagate /Hitachi ) factory information number of hours powered up = 17425.28 number of minutes until next internal SMART test = 4 Error counter log: Errors Corrected by Total Correction Gigabytes Total ECC rereads/ errors algorithm processed uncorrected fast | delayed rewrites corrected invocations [10^9 bytes] errors read : 38164 0 0 38164 0 0.017 0 write: 0 0 0 0 0 282.140 0 verify: 644952115 0 0 644952115 0 120969.768 0 Non-medium error count: 2 No Self-tests have been logged |
参考:
1 2 3 | https: //www .smartmontools.org /browser/trunk/smartmontools/smartctl .8. in https: //www .smartmontools.org /wiki/Supported_RAID-Controllers https: //www .smartmontools.org /wiki/Download |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)