:: Re: [DNG] Can this drive be saved?
Top Page
Delete this message
Reply to this message
Author: Hendrik Boom
To: dng
Subject: Re: [DNG] Can this drive be saved?
On Sat, Aug 29, 2020 at 06:45:15PM -0700, Gregory Nowak wrote:
> On Sat, Aug 29, 2020 at 04:35:01PM -0500, golinux@??? wrote:
> > What are the chances of fsck repairing the bad sectors? I shamefully admit I
> > have not thought about fsck for years.
> This looks to be at the media level, so is most likely beyond
> fsck. Since you said you can afford to lose this drive's contents, I
> would suggest using dd to fill the drive with zeros:
> dd if=/dev/zero of=/dev/sdx
> where /dev/sdx is the designation for your drive. This might cause the
> drive to reallocate the bad sector, or to mark the bad sector as good
> again.

There's also the badblocks program, which can be set up either to do a
nondestructive read-only test for bad blocks, or a more throrough
destructive test, where it writes every block and later checks tht it
can read it correctly again, using a variety of bit patterns.

That might make the hard drive reassign the bad blocks on its own.

If the hard drive doesn't do that, you can always use the -c option of
the e2fsck and mke2fs so that the ext2 file system will avoid using any
of the bad blocks of its own accord.

It's possible to feed the results from badblocks in to the e2fsck or
mke2fs yourself (instead of using the -c option) but it's recommended
you *not* do that because you have to tell badblocks several file-system
paramters in order for its list of bad blocks to match the file-system's
block numbering scheme, and e2fsck and mke2fs know how to do this

-- hendrik

> Then, run a SMART test on the drive again. If it still fails,
> then that drive probably can't be fixed. If the SMART test passes this
> time, you can restore your backups on to it and keep using it. If you
> do that, be very sure to sync that drive with your other backups
> frequently, and don't rely on it exclusively.
> If you don't want to wait for dd to write the entire drive, you can try
> following this tutorial instead:

badblocks in its most thorough mode will likely take longer than dd
because it writes and reads the entire drive multiple times, but it is

I use it to test new drives after purchase before use, and I have
occasionally ended up returning a new drive under warranty. The
replacement worked fine.

-- hendrik

> <https://www.smartmontools.org/wiki/BadBlockHowto>
> It seems to be old, but most if not all of it still seems relevant as
> well. You will almost certainly want to run
> e2fsck -f /dev/sdx1
> at the end of this process before mounting the drive. Good luck.
> Greg
> --
> web site: http://www.gregn.net
> gpg public key: http://www.gregn.net/pubkey.asc
> skype: gregn1
> (authorization required, add me to your contacts list first)
> If we haven't been in touch before, e-mail me before adding me to your contacts.
> --
> Free domains: http://www.eu.org/ or mail dns-manager@???
> _______________________________________________
> Dng mailing list
> Dng@???
> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng