:: Re: [DNG] Can this drive be saved?
Top Page
Delete this message
Reply to this message
Author: Tito
To: dng
Subject: Re: [DNG] Can this drive be saved?

Il 30/08/20 06:33, Gregory Nowak ha scritto:
> On Sat, Aug 29, 2020 at 10:36:26PM -0500, golinux@??? wrote:
>> On 2020-08-29 22:15, Gregory Nowak wrote:
>>> On Sat, Aug 29, 2020 at 09:15:13PM -0500, golinux@??? wrote:
>>>> dd if=/dev/zero bs=1M of=/dev/sdx
>>> That will just erase the first megabyte of the drive, leaving
>>> utilities like cfdisk to think the drive is new and unformatted. It
>>> won't attempt to over write the bad sector(s) though. See the other
>>> message I posted on how you can try to over write just the bad
>>> sector(s) faster.
>>> Greg
>> Gregory . . . the detailed instructions in this and your previous email are
>> very helpful. Thanks for catching the error. If needed, I will use this
>> command as you suggested:
> I just looked at what you posted earlier, and realized that it didn't
> give a count= parameter. So, the command you gave earlier would
> actually erase the entire drive one megabyte at a time instead of 512
> kilobytes at a time, which I believe is the default block size dd
> uses.
> So, to clarify,
> dd if=/dev/zero bs=1M of=/dev/sdx
> would in fact erase the entire drive. Apologies for the confusion.
> Greg

you can try to rewrite only the sectors at the LBA addresses shown in the smart test failure,
this often is enough to relocate them to spare sectors.
You might need to repeat it a few times until all bad sectors are relocated.
You should also check that the drive is properly powered, once I got mad
at a raid array showing a lot of errors like this just due to a faulty PSU.



while getopts ":h" opt; do
        case $opt in
                        echo "Usage $(basename $0) SECTOR DEVICE" >&2
                        exit 0
                        echo "Invalid option: -$OPTARG" >&2
                        exit 1

if [ $# -ne 2 ] ; then
        echo "Usage $(basename $0) SECTOR DEVICE"
        exit 1
if [ -b $2 ] ; then
        echo -n "This can potentially destroy all data on $2. Are you sure? [y|N] "
        read ans
        if [ "x$ans" != "xy" ] ; then
                echo "Exiting..."
                exit 0
        hdparm --yes-i-know-what-i-am-doing  --repair-sector $1 $2
        echo "Error: $2 is not a block device"
        exit 1
exit 0


Hope this helps, but use at your own risk.