I accidentally dd'd the first 512 bytes using:
dd if=/dev/zero of=/dev/sdb bs=512 count=1
and the partition table is now gone. Is there ANY way to re-create the partition table and rescue the still existing partition? I read up on parted's manual, and found the following commands:
mklabel - to create a new label on the disk (but does it also create a new partition table?)
rescue - to try and rescue the partition around the given START and END
My hard drive is 500GB and has only 1 partition on it, in NTFS file format.
Any help would be much appreciated.
Last edited by silentz0r (2011-03-27 16:17:36)
Hmmm.. with GTP rather than MBR you could recover it with its redundant backup using gdisk. I'm guessing you used an MBR though.... maybe someone else can help. Have you tried googling?
I did google a lot but didn't come across anything like my situation. Most people had deleted the partition from the partition table. I don't know what GTP is, and I didn't have a backup of the partition table
testdisk can scan for filesystems and generate a partition table based on where it finds them.
Last edited by tavianator (2011-03-26 23:15:31)
I tried using testdisk but it didn't recognise any partitions. Also tried photosomething which was similar to testdisk, and wasn't able to do anything useful.
Also tried gpart, gives a fatal error.
*** Fatal error: dev(/dev/sdb): seek failure.
Last edited by silentz0r (2011-03-26 23:46:13)
Well, if you had only one partition, it should be doable to recreate it... It will probably start either from sector 63 or sector 2048, and end at the end of the disk.
I've never done that, but I think if you launch the same tool you used to create the partition the first time, and use it to create an NTFS partition spanning the whole disk, but *don't* format it, then you might be able to access your partition as before.
It would be best if you could first backup your whole disk with dd to another disk, of course. And then mount the new partition as read-only to avoid destroying your files if something is not right...
I'll just repeat here that I've never done that, so there's no guaranty .
I know it's Windows, but try Partition Wizard (Home Edition). It saved my disk once, although it had NTFS partitions. Anyway, you could try it out.
Vanity of vanities, saith the Preacher, vanity of vanities; all is vanity.
What profit hath a man of all his labour which he taketh under the sun?
All the rivers run into the sea; yet the sea is not full; unto the place from whence the rivers come, thither they return again.
For in much wisdom is much grief: and he that increaseth knowledge increaseth sorrow.
Thanks everyone for your help, I have managed to solve this. Here's what I did:
(I had no backup of the MBR)
sdb was my broken drive, and did the following:
(parted) print Error: /dev/sdb: unrecognised disk label (parted) mklabel (parted) mklabel msdos (parted) rescue Start? 0 End? 976773168 // This was just a random guess. Information: A ntfs primary partition was found at 32.3kB -> 500GB. Do you want to add it to the partition table? Yes/No/Cancel? yes (parted) quit Information: You may need to update /etc/fstab.
And everything works now.
For the record, I am making MBR backups for all my drives while I'm typing this.
Hope this helps someone in the future! Marked as solved.
One suggestion: If it is only a data disk (wrt Windows), use http://wiki.archlinux.org/index.php/GUI … tion_Table to recover from these problems. GPT stores a backup partition table at the end of disk. To boot windows from a GPT disk you need UEFI firmware, but you dont need UEFI to use GPT disk as a data disk alone.
My new forum user/nick name is "the.ridikulus.rat" .