[plug] re; bad block on disk

/sbin/Southen southen at gmail.com
Wed Jun 6 18:29:57 WST 2012


On Wed, Jun 6, 2012 at 3:22 PM, Andrew Cooks <acooks at gmail.com> wrote:
> On Wed, Jun 6, 2012 at 11:45 AM, Brad Campbell <brad at fnarfbargle.com> wrote:
>> On 06/06/12 10:30, Andrew Cooks wrote:
>>
>>>     dd if=/dev/sdb1 of=/mnt/recover_sdb1 conv=noerror bs=1024k
>>
>>
>> I tried this recently and got burned. the conv=noerror means it won't abort
>> on an error, but it also won't write the entire block to the output stream.
>> It will only write out what it managed to read. This leaves the remainder of
>> your filesystem mis-aligned and badly broken.
>>
>> I had to add conv=sync to make dd pad the unread part.
>>
>
> Thanks for the correction!

dd is in my experience completely useless for recovery purposes, if
your distro lacks ddrescue grab SystemRescueCd.

As suggested, find a destination partition/drive (with twice the
needed space) and run:
 ddrescue -n /dev/sdb1 /mnt/recover/sdb1 /mnt/recover/sdb1.logfile
 ddrescue -d -r3 /mnt/recover/sdb1 /mnt/recover/sdb1.logfile
(where /dev/sdb1 is the partition or drive to rescue, and /mnt/recover
is a nice large partition)

The first pass tries to recover the most it can as fast as possible,
while the second tries to recover the parts that failed in the first
pass  in increasingly smaller chunks (by referring to the created
log). I have personally rescued all but a few hundred KB of 400GB
(over two ext4 partitions, ddrescue does whole drives too) that dd had
failed to copy beyond a couple of gig - if the drive gets kicked out
of /dev, unable to read at all, etc. you can restart the first pass
with -T to resume at full speed, while preserving what has been
successfully rescued (according to the log file).
Read the info pages for more details and examples.

You are definitely better off making a copy of the rescued image to
run any fsck's or other read-write recovery utils on, once you are
convinced ddrescue has copied all it can.

-- 
Sebastian Southen
Vice President & Systems Administrator,
Murdoch IT Society


More information about the plug mailing list