我们想通过以下方式识别坏块或磁盘问题
umount /grid/sdd
badblocks -n -vv /dev/sdd
Checking for bad blocks in non-destructive read-write mode
From block 0 to 20971519
Checking for bad blocks (non-destructive read-write test)
Testing with random pattern: 14.38% done, 2:46 elapsed. (0/0/0 errors)
问题是验证需要很长时间,如果我们有5T磁盘,则需要超过30小时
还有其他选项或工具可以更快地完成此操作吗?
检查20G磁盘,工具30Min
badblocks -n -vv /dev/sdd
Checking for bad blocks in non-destructive read-write mode
From block 0 to 20971519
Checking for bad blocks (non-destructive read-write test)
Testing with random pattern: done
Pass completed, 0 bad blocks found. (0/0/0 errors)
答案1
首先,可以badblocks
通过使用破坏性(-w
)模式(而不是非破坏性-n
)将运行时间减半。
您可能还想调整块大小和块数量:
-b block_size
Specify the size of blocks in bytes. The default is 1024.
-c number of blocks
is the number of blocks which are tested at a time. The default
is 64.
块的数量仅受可用内存的限制。块大小应与磁盘的块大小匹配,现在通常为 4096。您可以通过以下方式检查:
lsblk -o NAME,PHY-SeC
至于检测磁盘问题,现在通常的方法是SMART。现代磁盘将重新映射发生故障的扇区,并且它们甚至不会显示在badblocks
.您可以让 SMART 运行它的过程并不时检查它 ( smartctl -H /dev/sda
),或者您可以强制进行测试,例如smartctl -t long
。此测试不会(或在较小程度上)干扰磁盘的正常运行。换句话说,badblocks
被 SMART 取代。