Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I got small problem. I need to make a mirror of a disk. Zero it and then restore data.

I'm using DD linux command to copy data to a file.

sudo dd if=/dev/sde of=/media/Rozne-new/hitachi_disk2.img bs=1M

The problem is, Harddisk is 250GB big, and ooutput is 15GB file.

First partition is 14GB (according to disk utility). All partitions on this disk are unmounted.

share|improve this question

migrated from stackoverflow.com Nov 16 '12 at 20:41

This question came from our site for professional and enthusiast programmers.

1  
Did you get any errors after dd finished? –  Joakim Gebart Nov 16 '12 at 13:20
    
Even the best compression wouldn't have made this possible, which means, the image file is not complete. –  Ramhound Nov 16 '12 at 13:24
    
No errors. just info: dd: reading `/dev/sde': Input/output error 3639+1 records in 3639+1 records out 15265935360 bytes (15 GB) copied, 568.663 s, 26.8 MB/s Unelss, its an error... –  Gacek Nov 16 '12 at 13:34
    
Also, disk have 26 pending bad sectors. That's why i want to back it up, zero and see if it can still work. –  Gacek Nov 16 '12 at 13:35
    
Sorry, i'm not dd and linux specialist. more like intermediate ;). So this seems line an error. If it is, is there any possibility to ignore it or smth? or display what kind of error is it? –  Gacek Nov 16 '12 at 13:40

2 Answers 2

up vote 5 down vote accepted

To ignore read errors do this:

sudo dd if=/dev/sde of=/media/Rozne-new/hitachi_disk2.img bs=1M conv=noerror

To see all the options available to you type this:

dd --help
share|improve this answer
    
Shouldn't noerror be conv=noerror? –  palacsint Nov 18 '12 at 9:25
1  
@palacsint - you are absolutely correct. I've corrected my answer, thank you for pointing that out. –  Benny Hill Nov 19 '12 at 0:27

If you have bad blocks you could try dd_rescue:

  • dd_rescue does not abort on errors on the input file, unless you specify a maximum error number. Then dd_rescue will abort when this number is reached.
  • It uses two block sizes, a large (soft) block size and a small (hard) block size. In case of errors, the size falls back to the small one and is promoted again after a while without errors.

Be careful with dd:

  • If there is a small error inside a bigger block, it skips the subsequent sectors from that block. So, if only the first 512-byte sector is unreadable in a 1 megabyte block you lost 1 megabyte of data.
  • Without conv=sync it skips the unreadable and subsequent sectors from the erroneous blocks (instead of writing out zeros) which shifts the remaining blocks and could cause further filesystem damage.

Reference: Disk drive recovery: ddrescue, dd_rescue, dd_rhelp, by John Gilmore

share|improve this answer
1  
Or ddrescue. –  Karan Nov 18 '12 at 1:37
    
@Karan: Thanks for the hint! I think you should write it as an asnwer. I'd upvote that too. –  palacsint Nov 18 '12 at 9:24
    
Thanks, but it was just an add-on to your answer, so if you want feel free to incorporate it. :) I agree with John Gilmore though - as per my own experience ddrescue was better at retrieving data from a dying drive as compared to dd_rescue. –  Karan Nov 18 '12 at 21:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.