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

2018-10-10 Thread Assaf Gordon

tags 6667 notabug
close 6667
stop

Hello,

On 19/07/10 08:44 AM, Pádraig Brady wrote:

On 19/07/10 10:05, Jakub Muszynski wrote:

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.

[...]

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.


With no further comments in 8 years, I'm closing this item.

regards,
 - assaf





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

2010-07-19 Thread Pádraig Brady
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.





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

2010-07-19 Thread Jakub Muszynski
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, (btw, a option to log dd output(errors) would be
usefull, since i use screen terminal)

 r...@gamma:/home/jacek# fdisk -l /dev/sdb

Disk /dev/sdb: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x5517132d

   Device Boot  Start End  Blocks   Id  System
/dev/sdb1   1 262 2098176   27  Unknown
/dev/sdb2   * 2635485419487497  HPFS/NTFS
/dev/sdb35486   38913   268510410f  W95 Ext'd (LBA)
/dev/sdb5   12037   38913   215889502+  83  Linux
/dev/sdb68696   1203626836551b  W95 FAT32
/dev/sdb754866377 7164927   83  Linux
/dev/sdb863786499  979933+  82  Linux swap / Solaris

Partition table entries are not in disk order

finally i managed to make image with this command:
dd if=/dev/sdb conv=noerror,sync |pv| dd of=usb320.dd conv=noerror,sync  > 
dd320.LOG

i guess that problem is bs size + sync + badblocks
My disc contain about 2GB bad blocks (around 112Gbyte sector)
thoese 4194304 sectors, exchenged (due to sync flag) for empty sectors
in image file, would be:
with bs=4096k: 4194304 * 4096k = 17592GB (that would definitely not fit
on my disk)
with bs=512: 4194304 * 512 = 2147MB (thats ok)

so i guess, that dd is not considering what is block size while
exchanging broken block in the image file.

I'm not sure if it can be called a bug, but in my opinion is should be
at least mentioned in manual (to care about block size while making dump
of broken disc)

btw - ddrescue also filed to complete backup.

if you want more feedback - i still have the same hardware
configuration, so i can provide more test
Sirkubax



r...@gamma:/mnt/csda8# dd --version
dd (coreutils) 7.4
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Paul Rubin, David MacKenzie, and Stuart Kemp.
r...@gamma:/mnt/csda8#