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'm trying to back up the Windows Recovery Partition on a laptop using ddrescue. I tried using dd, but I kept getting an Input Output error (at about 9.65 GB through, if it matters), so I learned that ddrescue might be more useful. However, I don't know how to translate the commands of dd for ddrescue, as I'm copying in steps (1 GB at a time).

For example, a dd and ddrescue of the first 512 bytes of the partition give different results.

ubuntu@ubuntu> sudo dd if=/dev/sda2 count=1 | hexdump                         ~
0000000 52eb 4e90 4654 2053 2020 0020 0802 0000
0000010 0000 0000 f800 0000 003f 00ff b917 111e
0000020 0000 0000 0080 0080 d1a8 0182 0000 0000
0000030 98a8 0002 0000 0000 e4fd 0003 0000 0000
0000040 00f6 0000 0001 0000 071c 8874 743c 2c88
0000050 0000 0000 33fa 8ec0 bcd0 7c00 68fb 07c0
0000060 1e1f 6668 cb00 1688 000e 8166 033e 4e00
0000070 4654 7553 b415 bb41 55aa 13cd 0c72 fb81
0000080 aa55 0675 c1f7 0001 0375 d2e9 1e00 ec83
0000090 6818 001a 48b4 168a 000e f48b 1f16 13cd
00000a0 839f 18c4 589e 721f 3be1 0b06 7500 a3db
00000b0 000f 2ec1 000f 1e04 335a b9db 2000 c82b
00000c0 ff66 1106 0300 0f16 8e00 ffc2 1606 e800
00000d0 0040 c82b ef77 00b8 cdbb 661a c023 2d75
00000e0 8166 54fb 5043 7541 8124 02f9 7201 161e
00000f0 0768 16bb 7068 160e 0968 6600 6653 6653
0000100 1655 1616 b868 6601 0e61 cd07 e91a 016a
0000110 9090 6066 061e a166 0011 0366 1c06 1e00
0000120 6866 0000 0000 5066 5306 0168 6800 0010
0000130 42b4 168a 000e 1f16 f48b 13cd 5966 5a5b
0000140 5966 5966 0f1f 1682 6600 06ff 0011 1603
0000150 000f c28e 0eff 0016 bc75 1f07 6166 a0c3
0000160 01f8 08e8 a000 01fb 02e8 eb00 b4fe 8b01
0000170 acf0 003c 0974 0eb4 07bb cd00 eb10 c3f2
0000180 0a0d 2041 6964 6b73 7220 6165 2064 7265
0000190 6f72 2072 636f 7563 7272 6465 0d00 4e0a
00001a0 4c54 5244 6920 2073 696d 7373 6e69 0067
00001b0 0a0d 544e 444c 2052 7369 6320 6d6f 7270
00001c0 7365 6573 0064 0a0d 7250 7365 2073 7443
00001d0 6c72 412b 746c 442b 6c65 7420 206f 6572
00001e0 7473 7261 0d74 000a 0d74 000a 0000 0000
00001f0 4552 4f43 4556 5952 9d80 c6b0 0000 aa55
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.0249875 s, 20.5 kB/s
0000200

And ddrescue:

sudo ddrescue -s 512  /dev/sda2 - | hexdump
0000000 0a0a 7250 7365 2073 7443 6c72 432d 7420
0000010 206f 6e69 6574 7272 7075 0a74 0a0a 0d0a
0000020 5b1b 1b41 415b 5b1b 7241 7365 7563 6465
0000030 203a 2020 2020 2020 2020 2030 2c42 2020
0000040 7265 7372 7a69 3a65 2020 2020 2020 3020
0000050 4220 202c 6320 7275 6572 746e 7220 7461
0000060 3a65 2020 2020 2020 2020 2030 2f42 0a73
0000070 2020 6920 6f70 3a73 2020 2020 2020 2020
0000080 3020 4220 202c 2020 7265 6f72 7372 203a
0000090 2020 2020 2020 2c30 2020 2020 7661 7265
00000a0 6761 2065 6172 6574 203a 2020 2020 2020
00000b0 3020 4220 732f 200a 2020 706f 736f 203a
00000c0 2020 2020 2020 2020 2030 2c42 2020 2020
00000d0 7420 6d69 2065 7266 6d6f 6c20 7361 2074
00000e0 7573 6363 7365 6673 6c75 7220 6165 3a64
00000f0 2020 2020 2020 3020 7320 430a 706f 6979
0000100 676e 6e20 6e6f 742d 6972 6465 6220 6f6c
0000110 6b63 2e73 2e2e 0d0d 5b1b 1b41 415b 5b1b
0000120 7241 7365 7563 6465 203a 2020 2020 2020
0000130 3135 2032 2c42 2020 7265 7372 7a69 3a65
0000140 2020 2020 2020 3020 4220 202c 6320 7275
0000150 6572 746e 7220 7461 3a65 2020 2020 2020
0000160 2020 2030 2f42 0a73 2020 6920 6f70 3a73
0000170 2020 2020 2020 2020 3020 4220 202c 2020
0000180 7265 6f72 7372 203a 2020 2020 2020 2c30
0000190 2020 2020 7661 7265 6761 2065 6172 6574
00001a0 203a 2020 2020 2020 3020 4220 732f 200a
00001b0 2020 706f 736f 203a 2020 2020 2020 2020
00001c0 2030 2c42 2020 2020 7420 6d69 2065 7266
00001d0 6d6f 6c20 7361 2074 7573 6363 7365 6673
00001e0 6c75 7220 6165 3a64 2020 2020 2020 3020
00001f0 7320 460a 6e69 7369 6568 2064 2020 2020
0000200 2020 2020 2020 2020 2020 2020 2020 0a0d
0000210

Am I understanding ddrescue wrong? Are there simpler ways to back up that partition? (Also, is it important to note down the starting and ending positions of the partition, in case I do need to restore it?)

share|improve this question
    
Backing up a recovery partition that is already damaged seems pointless. Best to replace the failing drive and reinstall from cd. –  psusi May 14 '12 at 15:36
add comment

1 Answer

up vote 3 down vote accepted

I tried to reproduced your commands with dd and ddrescue

with dd

# dd if=/dev/sda2 of=1.img count=1

with ddrescue

# ddrescue -s512 /dev/sda2 2.img

and then do a compare on them

# cmp 1.img 2.img ; echo $?
0

quote from manpage of cmp

Where exit status of cmp is 0 if inputs are the same, 1 if different, 2 if trouble.

ddrescue can try very hard to rescue data in case of read errors.

testdisk is also a data recovery utility, but with text UI to select a partition to work with.

share|improve this answer
add comment

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.