Linux – Recover Linux vmdk VMware file

linuxmbrmountvmware-workstation

I am running Xubuntu 12.04 inside VMware Workstation 7. Long story short, I had created a restore script for another PC that wiped the full 512 byte MBR, ran fdisk to create some partitions, and then restored them through tools like partimage. Needless to say, I accidentally ran this script as root inside my Xubuntu VM and now it fails to boot (the script wiped the MBR and ran fdisk to create the partitions on my VM disk, but then failed and aborted, so all the data is there, it's just that the partition table is totally screwed up and now VM won't boot nor will it mount the drive when I try to run a live CD).

So how would I restore the MBR on my vmdk so that it can boot again? At the very least, how can I make it so that I can at least mount it to recover my files? It is an EXT4 drive so I'm not sure the built-in VMware tool of mapping it will work. If I created a separate VM with the same exact HD size and setup as before and ran the Xubuntu install again, could I take that MBR and restore it on my screwed up vmdk? Any help would be appreciated on this as my data is pretty important. Thanks.

Best Answer

Create another VM install your favorite OS and attach the vmdk onto the new VM, then perform partition table recovery from your new installation. Give http://www.cgsecurity.org/wiki/TestDisk a try