1

I am currently trying to recover a hard drive I accidentally formatted, but am of course, using dd if=/dev/sdb of=/dev/sdc conv=noerror,sync to make a backup to work on first. I have two questions, actually.

  1. dd is sloooooooowwwwww. My partition table and file system are damaged from the accidental format, if I use a larger block size via -bs option, would this somehow affect the drive geometry of the copy?

  2. Since it's bit to bit and I'm only working with the partition table/file system which are at the start of the drive; if I need to re-copy the original drive to the backup, can't I just abort dd after the first few MBs, since the rest of the drive should remain unchanged?

I'm hoping one of these is a yes, otherwise I've got about ten hours to go.

0

2 Answers 2

1

If you need to backup just the partition table & MBR then use:

dd if=/dev/SOURCE of=/my/path/to/MBR_BACKUP bs=512 count=1

Alternatively use sfdisk:

sfdisk -d /dev/SOURCE > /my/path/to/MBR_BACKUP

Then to restore:

sfdisk /dev/DEST < /my/path/to/MBR_BACKUP

All of the above will be very quick.

To image your entire hard drive, I'd suggest you set the BS to half the size of the drives cache, for example with Seagate 1TB drives w/ 64mb cache I use bs=32M. It'll speeds things up.

3
  • Okay, great! Thank you! I thought I could do that but just wanted to make sure. Why half the cache size?
    – ridgek
    Oct 3, 2013 at 3:45
  • A while ago, needing to rebuild a significant number of drive arrays, I did some benchmarks and that's just what worked best for me. The first link in hololeap's answer has more info and benchmarks on the subject.
    – Nanzikambe
    Oct 3, 2013 at 5:04
  • 1
    Ah, okay, thank you very much! A full copy has gone from 11 hours to less than 2 using 8MB for my 16MB cache size, and of course basically instantaneous to just move the first 512b. :)
    – ridgek
    Oct 5, 2013 at 23:59
0

dd is a very small, very efficient program and the slowness is probably from the read/write delay on your hard drives. In short: dd is as fast as your system allows it to be. You could try using a larger bs and this question is answered on the Unix and Linux Stack Exchange site.

The MBR and partition table are just the first 512 bytes, so it shouldn't take long for you to copy that, but I don't see the point of making a backup of a corrupted partition table. Let dd take its time making a backup of your hard drive, but then what you will need to do is try to recover information on the location of your partitions on the hard drive so that you can re-create the partition table. There is software that will do this for you.

Check out these links for more info:

http://www.pixelbeat.org/docs/disk/
http://www.diskinternals.com/partition-recovery/
http://www.dedoimedo.com/computers/linux-data-recovery.html

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .