/bin/dd fails with big disks containing bad sectors

Julian Elischer julian at elischer.org
Thu Jan 4 23:04:19 UTC 2007


James Risner wrote:
> Hello,
> 	I filed this PR (http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/107443) and it was
> suggested I bring the issue to this list.
> 
> If you have a defective disk larger than 2 gb with many bad sectors and attempt to use
> dd under FreeBSD to duplicate the disk, the operation will fail with sectors being out of alignment.
> 
> dd bs=512 if=src of=dst conv=noerror,sync
> 
> Under Linux, this operation performs as expected.
> There are faster methods of duplicating the disk (tools/recoverdisk is one.)
> But sometimes you only have /bin/dd and a fixit disk.  It isn't intuitive that
> dd should fail in the way it is failing.  The user (in this case me) doesn't expect
> to have a disk improperly aligned.
> 
> I once resolved this issue several years ago with a patch to dd that is no long valid with
> current sources.  I recently resolved this issue by writing my own tiny dd program (code
> is provided for curious people in the pr kern/107443) to properly copy the blocks.
> 
>>From what I can tell there are several requirements for this issue:
> 1) Disk > 2Gb
> 2) Disk has more than a few bad sectors.
> 3) Use dd to copy the disk.
> 
> It seems despite using "sync", dd is getting confused as to the input and output seek position.
> They get out of sync with each other and all future output blocks are written earlier on the disk
> than is required.

there is a tool in the tools directory (i forget the name) that is 
specifically for reading bad disks..

written by phk..

gets this right..along with various tricks to try get back more data.


> 
> James Risner
> _______________________________________________
> freebsd-hackers at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe at freebsd.org"



More information about the freebsd-hackers mailing list