硬盘各项检测
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 磁盘利用率
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步