Accidentally dd'ed an image to wrong drive / overwrote partition table + NTFS partition start

Posted by Kento Locatelli on Super User See other posts from Super User or by Kento Locatelli
Published on 2012-07-07T12:38:23Z Indexed on 2012/07/07 15:18 UTC
Read the original article Hit count: 231

Filed under:
|
|
|
|

I screwed up and set the wrong output for dd when trying to copy a freenas iso, overwriting the wrong external hard drive. Ironically, I was trying to setup a freenas server for data backup...

  • External drive is only used for data storage, system is entirely intact
  • Drive had a single NTFS partition filing the entire device (2TB WD elements)
  • Drive originally had an MBR partition table. Drive now shows as having a GPT, presumably from the freenas image.
  • Drive was mounted at the time, with maybe a couple kB of data written/read after running dd
  • Drive is just a few months old and healthy (regular SMART / fs checks)
  • I have not reboot the OS (crunchbang)
  • /proc/partition still holds the correct information (and has been stored)
  • Have dd's output (records in / out / bytes)
  • testdrive did not find any partitions on quick or deep search
  • running photorec to recover the more important data (a couple recent plaintext files that hadn't been backed up yet). Vast majority of disk content (> 80%) is unnecessary media files.

My current plan is to let photorec do it's thing, then recreate the mbr with gparted and use cfdisk to create another NTFS partition using the sector information from /sys/block/.../. Is that a good course of action (that is, a chance of success)? Or anything else I should try first?

Possibly relevant information:

dd if=FreeNAS-8.0.4-RELEASE-p3-x86.iso of=/dev/sdc:
194568+0 records in
194568+0 records out
99618816 bytes (100 MB) copied

grep . /sys/block/sdc/sdc*/{start,size}:
/sys/block/sdc/sdc1/start:2048
/sys/block/sdc/sdc1/size:3907022848

cat /proc/partitions:
major minor  #blocks  name
** Snipped **
   8       32 1953512448 sdc
   8       33 1953511424 sdc1

current fdisk -l output: 
WARNING: GPT (GUID Partition Table) detected on '/dev/sdc'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sdc: 2000.4 GB, 2000396746752 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/sdc doesn't contain a valid partition table

© Super User or respective owner

Related posts about linux

Related posts about ntfs