Badblocks: Difference between revisions
(Created page with "Badblocks is a tool for detecting bad blocks in your hard disk. ==Usage== The following will write to every block and read back to identify the number of bad blocks. '''This...") |
(→Usage) |
||
Line 7: | Line 7: | ||
badblocks -wsv -b 4096 /dev/sdg | badblocks -wsv -b 4096 /dev/sdg | ||
</pre> | </pre> | ||
* <code>-w</code> do a write test | * <code>-w</code> do a destructive write test | ||
* <code>-s</code> show progress | * <code>-s</code> show progress | ||
* <code>-v</code> verbose | * <code>-v</code> verbose | ||
* <code>-b ''num''</code> block size. Use 4096 typically. | * <code>-b ''num''</code> block size. Use 4096 typically. | ||
* <code>-p ''num''</code> do ''num'' iterations. Typically 1 is sufficient. | * <code>-p ''num''</code> do ''num'' iterations. Typically 1 is sufficient. | ||
* <code>-t ''test_pattern''</code> Test pattern. Select from [random, | * <code>-t ''test_pattern''</code> Test pattern. Select from [random, | ||
To save the list of bad blocks, you need to run <code>fsck</code> or <code>mkfs.ext4</code>: | |||
* <code>sudo e2fsck -fcck /dev/device</code> | |||
** <code>-f</code> force check | |||
** <code>-cc</code> non-destructive write test | |||
** <code>-k</code> add bad blocks to bad blocks list | |||
* <code>mkfs.ext4 -cc /dev/device</code> | |||
==Resources== | ==Resources== | ||
* [[Archwiki: Badblocks]] | * [[Archwiki: Badblocks]] |
Revision as of 01:19, 4 July 2020
Badblocks is a tool for detecting bad blocks in your hard disk.
Usage
The following will write to every block and read back to identify the number of bad blocks.
This is a destructive test.
badblocks -wsv -b 4096 /dev/sdg
-w
do a destructive write test-s
show progress-v
verbose-b num
block size. Use 4096 typically.-p num
do num iterations. Typically 1 is sufficient.-t test_pattern
Test pattern. Select from [random,
To save the list of bad blocks, you need to run fsck
or mkfs.ext4
:
sudo e2fsck -fcck /dev/device
-f
force check-cc
non-destructive write test-k
add bad blocks to bad blocks list
mkfs.ext4 -cc /dev/device