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

From: Jakub Muszynski <[email-masked]>
Date: Mon, 19 Jul 2010 11:05:14 +0200

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)

 root@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   *         263        5485    41948749    7  HPFS/NTFS
/dev/sdb3            5486       38913   268510410    f  W95 Ext'd (LBA)
/dev/sdb5           12037       38913   215889502+  83  Linux
/dev/sdb6            8696       12036    26836551    b  W95 FAT32
/dev/sdb7            5486        6377     7164927   83  Linux
/dev/sdb8            6378        6499      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

root@gamma:/mnt/csda8# dd --version
dd (coreutils) 7.4
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>.
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.
root@gamma:/mnt/csda8#