Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I executed the following command from a Ubuntu live cd terminal (dont ask why).

 dd if=/dev/zero of=/dev/sdb2 bs=512 count=1

Where sdb2 is a NTFS partition (third partition) on a disk. Suffice to say it is now messed up. When I boot into windows 7, it does show me E drive but when I click on it it asks me to format it.

I am not ever sure what I did, did I mess up partition table or only the MFT? Is there any way to get the data back>

PLEASE HELP! this is very important :(

share|improve this question
Did you allow the operation to complete? If so your data is toast, if not you might have something recoverable left on the disk. – Tog Nov 29 '12 at 11:18
TestDisk to the rescue... And considering you pretty much overwrote your NTFS partition with zeroes, you might want to look at this (possibly related) question: How to recover deleted files from (formatted) FAT32/NTFS drive in Linux? – Breakthrough Nov 29 '12 at 11:54

Contrary to some opinions, your data is perfectly recoverable.
Your dd command have actually cleared only sector 0 of the partition. MFT or other important data is untouched. This (first) sector is called boot sector (and despite it's name is present on every NTFS volume) and it stores critical partition information. Because it's so critical, NTFS stores a copy of it (at the end of volume for current versions). This means you can restore your partition using backup copy (of boot sector).

Testdisk do include an option to recover boot sector from backup and it's probably your best option*. Your steps should be:

  • Calm down.
  • If possible, make an image of affected disk. While not strictly required, it gives you additional level of protection (and lessens stress, which often is a cause for stupid mistakes even in simple tasks). You may use testdisk for that as well.
  • In testdisk, select your disk and partition type and then go to Advanced. Select damaged partition.
  • Select boot. You should see warning that primary boot sector is bust and copies do not match. Select backup bs.
  • Write data to disk when asked. Exit testdisk.
  • Reboot and check your partition.

*It is possible to restore it using dd only, but I would not recommend it unless you fancy it and have a good backup copy of your data.

share|improve this answer

It could be very hard to recover your data, anyway in Ubuntu there's a package testdisk which contains some useful utilities to try to recover your data. You can install with

 sudo apt-get install testdisk

Another solution is to use a rescue live CD like this one SystemRescueCD. In the live CD there are many useful tools to try to recover your data.

Good luck! ;-)

share|improve this answer

You must log in to answer this question.

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