Howto: Recreate VMDK files
Written by Christian on March 3, 2008 – 6:48 pm
On ESX3, your VM has one or more VMDK files (extension .vmdk) and one or more flat vmdk files (last characters flat.vmdk )
In some cases, you may corrupt, lose or accidentally delete your VMDK files. Your VMDK’s contain metadata for your flat.vmdk files. Without your VMDK’s, you cannot load your flat.vmdk-files. Consequence: you cannot load the VM in your VirtualCenter and you cannot start the VM.
The following steps will guide you to recreate your vmdk files (.vmdk):
- Determine the hard disk sizes of your original VM (I call this VM from now on: VM A)
- Create a new VM (I call this VM from now on: VM B) with VirtualCenter with the same number of hard disks as your old VM, and the exact same sizes. So: if your original VM contained 2 harddisks from 8,00GB and 12,00GB, recreate these harddisks exactly the same in your new VM.
- After your VM B has been created, use Putty (or a similar tool) to navigate to your ESX server. Then navigate to the location / directory where your VM B is stored.
- Copy all VMDK’s (not the flat ones, but only the metadata files) to your VM A directory. The filesize of your META-data files should be a few KB.
- Navigate to your VM A directory. You just copied the *.VMDK files to this directory. Edit the VMDK’s with a text editor: You should replace the old filenames with the correct file names -> They refer to the new VM B, but they should refer to your old (original) VM A
- Save the files.
- Load the VM in your VirtualCenter. You should now be able to add th flat.vmdk to your VM.
Is it still not working? Leave a comment, so I (or another visitor) can assist you!
People who read this article, also read:
- Howto: Recover corrupted VMDK files
- Copy files with YCopy instead of Windows Explorer
- SYSTEM process takes high CPU on server in VMWARE
Posted in VMWare |
March 14th, 2008 at 12:21 am
Thanks man! This article just saved my day. My VMDK was gone this morning. Had to recreate it. I’m glad I knew the disk sizes of my C and D partitions, I could remake that VMDK in a jiffy, and I was up and running again within 1 hour!
April 4th, 2008 at 5:47 am
Hi,
I have accidently deleted my flat.vmdk files, but have my other expanding vmdk files. Is there a way to recover it? or recover any sort of data at all? Any data would be great!
At the moment I have 4 files.
name-000001.vmdk
name-000001-delta.vmdk
name-000002.vmdk
name-000002-delta.vmdk
Missing the flat.vmdk.
Thanks in Advance.
April 8th, 2008 at 11:21 pm
Hi Nick,
when you have deleted your flat.vmdk file, I’m afraid there’s nothing you can do besides recovering the machine from a backup (if you have one…). This is because your flat.vmdk files contain all data (not your meta-data, but the REAL data)
July 4th, 2008 at 6:59 pm
An error said that the disk was corrupted and was not a virtual disk.
The log says that Windows XP Professional-000003.vmdk is corrupted. It is 0kb in size. It used to be 2.7GB.
How do I recover the file. The last snapshot I have is from 4 months ago. (I know. Stupid on my part.)
Here is a section of the log:
————————————-
Jul 04 01:21:05: vmx| ACL_InitCapabilities: here 1 (bug 63252)
Jul 04 01:21:05: vmx| changing directory to f:\virtual machines\windows xp professional\.
Jul 04 01:21:05: vmx| Config file: f:\virtual machines\windows xp professional\windows xp professional.vmx
Jul 04 01:21:05: vmx| Unable to find file Windows XP Professional-000003.vmdk
Jul 04 01:21:05: vmx| Unable to find file Windows XP Professional-000003.vmdk
Jul 04 01:21:05: vmx| DISKLIB-LINK : “Windows XP Professional-000003.vmdk” : failed to open (The file or directory is corrupted and unreadable).
Jul 04 01:21:05: vmx| DISKLIB-CHAIN : “Windows XP Professional-000003.vmdk” : failed to open (The file or directory is corrupted and unreadable).
Jul 04 01:21:05: vmx| DISKLIB-LIB : Failed to open ‘Windows XP Professional-000003.vmdk’ with flags 0×17 (The file or directory is corrupted and unreadable).
Jul 04 01:21:05: vmx| DISK: Cannot open disk “Windows XP Professional-000003.vmdk”: The file or directory is corrupted and unreadable (91226121).
Jul 04 01:21:05: vmx| DISKUTIL: GetDevVersion: couldn’t open file ‘Windows XP Professional-000003.vmdk’ : The file or directory is corrupted and unreadable (91226121).
Jul 04 01:21:05: vmx| DISKUTIL: Could not populate version buffer.
—————————————–
Here are the files in the directory:
06/28/2008 12:02 PM 8,664 nvram
01/25/2008 08:31 PM 0 Windows XP Professional (2).vmdk.lck
07/04/2008 09:50 AM 20,897 vmware.log
07/04/2008 01:21 AM 20,900 vmware-0.log
07/04/2008 01:20 AM 69,057 vmware-1.log
06/28/2008 06:21 AM 33,056 vmware-2.log
01/25/2008 08:33 PM 443 Windows XP Professional (2).vmdk
06/28/2008 12:02 PM 443 Windows XP Professional (3).vmdk
02/11/2008 10:12 PM 443 Windows XP Professional (4).vmdk
02/14/2008 08:15 PM 444 Windows XP Professional (5).vmdk
02/14/2008 08:20 PM 416 Windows XP Professional (6).vmdk
02/14/2008 08:20 PM 417 Windows XP Professional (7).vmdk
06/28/2008 12:02 PM 443 Windows XP Professional (8).vmdk
02/03/2008 11:03 AM 362 Windows XP Professional.vmdk
01/26/2008 01:34 AM 0 Windows XP Professional-000002.vmdk
07/04/2008 01:20 AM 0 Windows XP Professional-000003.vmdk
02/03/2008 11:03 AM 12,884,901,888 Windows XP Professional-flat.vmdk
06/27/2008 06:41 AM 268,435,456 windows xp professional.vmem
02/03/2008 11:09 AM 268,435,456 windows xp professional-Snapshot3.vmem
02/03/2008 11:03 AM 930 Windows XP Professional.vmsd
02/03/2008 11:09 AM 18,395,040 windows xp professional-Snapshot3.vmsn
06/28/2008 12:02 PM 18,000,730 windows xp professional.vmss
06/28/2008 12:02 PM 1,513 Windows XP Professional.vmx
Any help would be greatly appreciated. Thank you.
August 9th, 2008 at 10:29 am
thanks, you saved my bacon!!