:: Re: [DNG] Can this drive be saved?
Top Pagina
Delete this message
Reply to this message
Auteur: Tito
Datum:  
Aan: dng
Onderwerp: 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
>
>


Hi,
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.

fix_sector.sh

_________________________________________________________________________
#!/bin/bash

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


if [ $# -ne 2 ] ; then
        echo "Usage $(basename $0) SECTOR DEVICE"
        exit 1
fi
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
        fi
        hdparm --yes-i-know-what-i-am-doing  --repair-sector $1 $2
else
        echo "Error: $2 is not a block device"
        exit 1
fi
exit 0


________________________________________________________________________________

Hope this helps, but use at your own risk.

Ciao,
Tito