硬盘各项检测

时间:2020-05-09
本文章向大家介绍硬盘各项检测,主要包括硬盘各项检测使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

smartctl

安装smartctl

yum install smartmontools

查看硬盘信息和是否开启smartctl

smartctl -i /dev/sda

smartctl 7.0 2018-12-30 r4883 [x86_64-linux-3.10.0-123.el7.x86_64] (local build)
Copyright (C) 2002-18, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Western Digital Blue
Device Model:     WDC WD10EZEX-22MFCA0
Serial Number:    WD-WCC6Y2NL9FTK
LU WWN Device Id: 5 0014ee 2b83160d0
Firmware Version: 01.01A01
User Capacity:    1,000,204,886,016 bytes [1.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    7200 rpm
Form Factor:      3.5 inches
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ACS-3 T13/2161-D revision 3b
SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 3.0 Gb/s)
Local Time is:    Sat May  9 08:32:08 2020 CST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled #enabled表示开启

查看硬盘健康状态

smarctl -H /dev/sda

smartctl 7.0 2018-12-30 r4883 [x86_64-linux-3.10.0-123.el7.x86_64] (local build)
Copyright (C) 2002-18, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED #passed表示正常

badblocks

检查硬盘坏道

badblocks -s -v -o /root/1.txt /dev/sda  #检查硬盘/dev/sda坏道,然后把信息保存在/root/1.txt

硬盘坏道修复

badblocks -s -w /dev/sda END START (END代表需要修复的扇区末端,START代表需要修复的扇区起始端)
fsck -a /dev/sda #开启修复(修复后在检查是否有坏道,然后有就不是逻辑坏道,是硬盘坏道)

dd

纯写盘速度测试(没有包含io性能)

dd if=/dev/sda bs=1k count=1000000 of=1Gb.file

纯读盘速度测试(没有包含io性能)

dd if=1Gb.file bs=64k | dd of=/dev/null

fio

测试读硬盘io性能

顺序读

fio -filename=/opt/ioTest/out -direct=1 -iodepth 1 -thread -rw=read -ioengine=psync -bs=16k -size=2G -numjobs=10 -runtime=60 -group_reporting -name=mytest

随机写

fio -filename=/opt/ioTest/out -direct=1 -iodepth 1 -thread -rw=randwrite -ioengine=psync -bs=16k -size=2G -numjobs=10 -runtime=60 -group_reporting -name=mytest

顺序写

fio -filename=/opt/ioTest/out -direct=1 -iodepth 1 -thread -rw=write -ioengine=psync -bs=16k -size=2G -numjobs=10 -runtime=60 -group_reporting -name=mytest

混合随机读写

fio -filename=/opt/ioTest/out -direct=1 -iodepth 1 -thread -rw=randrw -rwmixread=70 -ioengine=psync -bs=16k -size=2G -numjobs=10 -runtime=60 -group_reporting -name=mytest -ioscheduler=noop

io           IO数据量
aggrb        平均总带宽
minb         最小带宽
maxb         最大带宽
mint         线程最短运行时间
maxt         线程最长运行时间
ios          总IO数,读/写
merge        发生IO合并的次数,读/写
ticks        Number of ticks kept the disk busy,读/写
in_queue     花在队列上的总时间
util         磁盘利用率

原文地址:https://www.cnblogs.com/yunweiweb/p/12855278.html