[svlug] Mapping out bad sectors using badblocks (was: Files That Will Not Delete)
rick at svlug.org
Sun Nov 2 08:16:59 PST 2014
> How long does this process usually take?
On an eSATA-connected 2TB external drive where you used the (default)
non-destructive mode (read-only) vs. destructive mode (read/write), it
might take 3-4 days. Destructive mode is faster. I note that you
forgot to include the -s flag to show percent completion of the current
pass. Destructive mode runs through four passes, writing and checking
a different pattern each time. As is often the case, the ArchLinux wiki
page on this subject is excellent:
Under the circumstances, you might want to start again with
the show-percentage, verbose, and destructive options.
badblocks -wsv -o /tmp/badblockslist /dev/sdd1
Your commend had all output forked off to a file using tee. Above instead
uses the -o (output bad sectors) switch, instead.
Important: 1. Make sure /dev/sdd1 is not mounted, when you do that.
2. For destructive mode, be aware that any filesystem that might exist
on /dev/sdd1 is going to get clobbered (in case that wasn't already obvious).
One of the benefits of using the -o option is that you can then pass that
information as input to the mk4s utility, e.g.:
mkfs.ext4 -l /tmp/badblockslist /dev/sdd1
Doing that will ensure that all those bad blocks are with certainty
included in the filesystem's inode of bad blocks. (Just to be sure that
badblocks and mkfs.ext4 are using the same block size, you should probably
also include -b 1024 with both commands. As the ArchLinux wiki page
mentions, you _could_ just run mkfs.ext4 -vcck /dev/sdd1 to have mkfs run a
badblocks check instead of running the two utilities separately, which would
work fine but be a bit less flexible.)
More information about the svlug