首页 > 其他分享 >smarctl 分析磁盘

smarctl 分析磁盘

时间:2023-09-11 11:11:06浏览次数:38  
标签:分析 smartctl -- dev device 磁盘 smarctl TYPE SMART

1、安装smartmontools软件包

apt-get install smartmontools # Debian/Ubuntu
yum install smartmontools # RedHat/CentOS

2、命令帮助

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、查看服务器上的硬盘情况

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、获取硬盘的各项参数情况

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

参考:

https://www.smartmontools.org/browser/trunk/smartmontools/smartctl.8.in
https://www.smartmontools.org/wiki/Supported_RAID-Controllers

  

标签:分析,smartctl,--,dev,device,磁盘,smarctl,TYPE,SMART
From: https://www.cnblogs.com/a120608yby/p/17693004.html

相关文章

  • VROPS报磁盘空间不足的处理
    当/storage/log/空间不足时,VROPS节点将变成脱机状态,这时需要删除日志文件来保证节点的正常工作。一,先为要处理的节点做快照,以防万一以本地管理员用户身份登录到vRealizeOperations管理UI。例如:https://IP_or_FQDN/admin在“群集状态”下,确定节点为脱机。 导航到vSpher......
  • MySQL基础篇:掌握MySQL数据排序,让你的数据分析事半功倍
    单一字段排序排序采用orderby子句,orderby后面跟上排序字段,排序字段可以放多个,多个采用逗号间隔,orderby默认采用升序,如果存在where子句那么orderby必须放到where语句的后面按照薪水由小到大排序(系统默认由小到大)mysql>select*fromEMPorderbySAL;+-------+--------+---......
  • 小程序性能优化:掌握性能分析工具与内存管理技巧
    在小程序开发中,高效的内存和性能管理是确保应用顺畅运行的关键。本文将介绍如何使用性能分析工具以及一些内存管理的技巧,帮助您优化小程序的性能。使用性能分析工具小程序开发工具提供了强大的性能分析工具,可以帮助您识别和解决性能瓶颈。以下是如何使用性能分析工具的示例:打开小程......
  • 元宇宙优劣势与机遇挑战分析_元宇宙解决方案
    元宇宙概念近年已成为各大科技巨头关注的焦点,还有不少企业对进局元宇宙持观望态度,本文对企业元宇宙解决方案进行了SWOT分析(优势和劣势、机会和威胁),以便企业更全面了解元宇宙。元宇宙的优势1)以消费者为导向企业可以在元宇宙中探索新的营销和销售方式。由于元宇宙采用了虚拟现实......
  • Spring源码分析(八)容器的扩展点(BeanPostProcessor)
    在前面两篇关于容器扩展的文章,我们已经完成了对BeanFactoryPostProcessor和FactoryBean的分析,对于BeanFactoryPostProcessor而言,它能让我们对容器中扫描出来的BeanDefinition做出修改以达到扩展的目的,而对于FactoryBean而言,它提供了一种特殊创建bean的手段,能让我们将一......
  • 用友U8与MES系统API接口对接案例分析
    企业数字化转型:轻易云数据集成平台助力U8ERP+MES系统集成为什么选择数字化转型?领导层对企业资源规划(ERP)的深刻理解促使了数字化转型的启动。采用精确的“N+5”滚动计划,为供应商提供充分的预期信息,确保准时化生产。精细管理刀具采购和车间设备,优化生产计划和过程。通过轻......
  • money详细日志分析--转
    一、Monkey日志详解Monkey日志由以下几部分组成:(1)测试命令信息:随机种子seed、运行次数、可运行应用列表、各事件百分比。​​​​​​​ (2)App切换和Activity跳转:可以看到切换到了哪个App,从哪个Activity跳转到了哪个Activity,如果发生了异常,就可以看出是在哪个A......
  • 深入浅出理解数据分析系列之:Python安装Excel文档库openpyxl和Pycharm为项目安装Excel
    深入浅出理解数据分析系列之:Python安装Excel文档库openpyxl和Pycharm为项目安装Excel文档库openpyxl一、Python安装openpyxl二、Pycharm为项目安装openpyxl一、Python安装openpyxlpip3installopenpyxlCollectingopenpyxlDownloadingopenpyxl-3.0.9-py2.py3-none-any.whl......
  • 2022年线下赛的一道流量分析题
    题目给了一个where_is_password.pcapngbinwalk看到里面有个压缩包,利用foremost分离出来压缩包需要密码分析流量包,发现存在sql注入提取出来进行url解码,可以看到利用二分法进行sql盲注ascii有128个所以从>64开始判断,返回用户名或密码错误,然后判断>32,没有返回错误,说明在3......
  • .Net8 AOT+VMP简单的逆向分析
    1.前言测试下VMP加密.NET的强度,选了最新的.Net8+AOT编译,用VMP给它加壳。最后逆向下,简单的分析,本篇看下。2.概述一.前奏首先一段简单的C#代码:namespaceTest_{internalclassProgram{staticvoidMain(string[]args){Console.WriteLine("hello,......