Subject: bug#6667: dd ?bug? while making image of hdd with bad sectors

From: Pádraig Brady <[email-masked]>
Date: Mon, 19 Jul 2010 15:44:35 +0100

On 19/07/10 10:05, Jakub Muszynski wrote:
> Hello,
> 
> It's my first post here, i hope it might be usefull.
> My full story can be found here:
> http://ubuntuforums.org/showthread.php?p=9607705#post9607705
> I will try to summarize it here:
> 
> I have broken (fall) hdd, now im sure that's contain ~2GB od broken
> sectors, in 1/3 of disc capacity.
> I have been trying to make a dd copy :
> 
> dd if=/dev/sdb conv=noerror,sync bs=4096k|pv| dd of=usb320.dd
> conv=noerror,sync bs=4096k > dd320.LOG 
> 
> but image took all my free diskspace (406GB), and terminated, eventhough
> my hdd is 320GB

dd doesn't read full blocks by default,
so one has to be careful when reading from pipes.
Is pv showing less than 406GB transferred?
less would suggest the issue is with the second dd.
Does adding "iflag=fullblock" to the second dd fix things?
Since you're not specifying a count, just removing the
"sync" option from the second dd is equivalent.
Note one can can progress from dd by sending `kill -USR1`
to the $pid every so often.
Note also that one could get a proper progress bar from pv with:
pv -s $(blockdev --getsize64 /dev/sdb)

> (btw, a option to log dd output(errors) would be
> usefull, since i use screen terminal)

How about just doing: 2>error.log

> btw - ddrescue also filed to complete backup.

Surprising since this is what it's designed for.

cheers,
Pádraig.