为了防止灾难,重要的是要了解系统存储设备的运行时间、读写次数或者坏块的详细信息,以确定整体硬盘驱动器的健康状况和老化程度。
对这项任务最有用的工具是找到并通过“smartmontools”包安装的“smartctl”命令。
以下是关于如何确定当前硬盘驱动器状态和整体健康状况的几个命令示例。
要检查硬盘的整体健康状况,我们可以使用 -H
选项。
例如这里是块设备/dev/sda
的健康检查
# smartctl -H /dev/sda === START OF READ SMART DATA SECTION === SMART overall-health self-assessment test result: PASSED
smartctl
命令允许系统管理员运行自检以确定硬盘驱动器的状况。
要启动此类健康自检,请使用以下参数之一运行以下 linux 命令:
offline, short, long, conveyance, force, vendor,N, select,M-N, pending,N, afterselect,[on|off]
以下示例将启动简短的健康检查:
# smartctl -t short /dev/sda Please wait 1 minutes for test to complete.
运行上述命令后,smartctl
命令将指示我们需要等待多长时间才能完成测试。
稍后可以通过以下方式检索自检结果:
# smartctl -l selftest /dev/sda smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.14.8-200.fc20.x86_64] (local build) Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org === START OF READ SMART DATA SECTION === SMART Self-test log structure revision number 1 Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error # 1 Vendor (0x50) Completed without error 00% 5007 # 2 Offline Completed without error 00% 5006
可以通过以下方式获得有关我们硬盘的最全面的健康状态信息:
smartctl --xall /dev/sda
这将打印出一般设备统计表和物理事件计数器表:
Device Statistics (GP Log 0x04) Page Offset Size Value Description 1 ===== = = == General Statistics (rev 2) == 1 0x008 4 3878 Lifetime Power-On Resets 1 0x010 4 5007 Power-on Hours 1 0x018 6 13095790289 Logical Sectors Written 1 0x020 6 677113980 Number of Write Commands 1 0x028 6 6489046492 Logical Sectors Read 1 0x030 6 74059526 Number of Read Commands 4 ===== = = == General Errors Statistics (rev 1) == 4 0x008 4 0 Number of Reported Uncorrectable Errors 4 0x010 4 0 Resets Between Cmd Acceptance and Completion 6 ===== = = == Transport Statistics (rev 1) == 6 0x008 4 23933 Number of Hardware Resets 6 0x010 4 10275 Number of ASR Events 6 0x018 4 0 Number of Interface CRC Errors 7 ===== = = == Solid State Device Statistics (rev 1) == 7 0x008 1 0 Percentage Used Endurance Indicator SATA Phy Event Counters (GP Log 0x11) ID Size Value Description 0x0001 4 0 Command failed due to ICRC error 0x0004 4 0 R_ERR response for host-to-device data FIS 0x0007 4 0 R_ERR response for host-to-device non-data FIS 0x0008 4 0 Device-to-host non-data FIS retries 0x0009 4 1 Transition from drive PhyRdy to drive PhyNRdy 0x000a 4 2 Device-to-host register FISes sent due to a COMRESET 0x000b 4 0 CRC errors within host-to-device FIS 0x000d 4 0 Non-CRC errors within host-to-device FIS 0x000f 4 0 R_ERR response for host-to-device data FIS, CRC 0x0010 4 0 R_ERR response for host-to-device data FIS, non-CRC 0x0012 4 0 R_ERR response for host-to-device non-data FIS, CRC 0x0013 4 0 R_ERR response for host-to-device non-data FIS, non-CRC
日期:2020-07-07 20:54:50 来源:oir作者:oir