A Little Virtual Machine Recreation

It's time for a little VM recreation and you don't even have to get sweaty in the process.

You’ve just scheduled a week of vacation in a remote location near some sand, water and a wee dram of your favorite beverage. Your backup feels confident that he can handle the situation while you’re gone but just before you walk out that door; you pick up your phone to hear a hysterical voice on the other end explaining that the accounting department VM crashed and now it won’t start up. You discover that the vmdk file that describes your VM’s disks has corrupted itself and isn’t repairable. Nothing makes your palms clammy as fast as a corrupted virtual machine (VM) but if you have a clean pair of sweat bands or a towel handy, you’ll survive it I promise.

Don’t let the air out of your favorite floatation device just yet. There’s hope for your VM and your vacation. You can recreate those corrupted VMDK disk descriptor files with little effort and no sweat.


A typical virtual machine descriptor (VMDK) is a small (~300B) text file that describes its associated disk file and named for the VM to which it refers. For example, if you have a VM named “RHEL5.4” then your primary VMDK file has the name RHEL5.4.vmdk. The primary disk file name is RHEL5.4-flat.vmdk and its size corresponds to the amount of space allocated to the VM’s primary disk.

Let’s look inside a VMDK file and examine it more closely. The following listing (VMDK File) is an actual live VMDK file taken from a VMware ESX 3.x host.


# Disk DescriptorFile

# Extent description
RW 75497472 VMFS "RHEL5.4-flat.vmdk"

# The Disk Data Base

ddb.adapterType = "lsilogic"
ddb.geometry.sectors = "63"
ddb.geometry.heads = "255"
ddb.geometry.cylinders = "4699"
ddb.toolsVersion = "7201"
ddb.virtualHWVersion = "4"

The version=1 entry refers to the version of the Disk Descriptor File. VMware products all have version=1 in their VMDK files. The CID, also known as the Content ID, is a randomly generated value and changes each time a VM starts. The parent CID has a default value of ffffffff and only changes if the VMDK is part of a snapshot. The createType line describes the type of virtual disk that’s defined by the VMDK. There are 12 possible values for this parameter. The type vmfs type means that the disk file resides on an ESX server disk volume. Extent description provides information regarding disk access, size (sectors), extent type and filename. In our example, the disk is Read/Writable, 36GB in size, VMFS extent type and the name of the actual disk file that is 36GB. Finally, the Disk Database describes the virtual disk’s drive geometry and adapter type.

Since this file is an ASCII text file, you can edit it with any text editor—a bit of trivia that will come in handy later. Each virtual disk, regardless of how many files compose the disk, has its own VMDK file.


I spent a lot of space going over VMDK anatomy to show you that VMDK files, while required, are not complex or cryptic. To recreate your corrupted VMDK file(s), you need to know one important piece of information: The original VM disk size(s). There are at least three ways to recreate the VMDK file (In order of increasing difficulty): Restore from backup, copy and edit a similarly configured VMDK file, Recreate a VM with same sized disks as the original and edit the disk filenames to which they refer.

There’s no substitute for a recent backup. Restore the VMDK to its original location and you’re back up and running in no time.

Since you don’t have a backup, you have to move to Plan B: Copy a similar file and edit the disk filenames. Often, VMs spring from a VM template, which means they all have the same disk configurations. If you have a VM with the same sized disk(s) as the corrupted one, copy the VMDK from a good VM to the corrupted VM’s directory. Edit the VMDK with a text editor only changing the name of the filename(s) to which it refers. Your VM should start without issue.

In the third scenario, either you don’t have any other VMs with similarly sized disks or you can’t figure out how to convert GB to sectors and calculate drive geometry. And you don’t have a good backup.

This procedure requires that you create a new VM with the same size disk(s) as your corrupted one (hopefully you have enough space to do so), and then follow the procedure described above in Plan B.

As you’ve seen, even the worst case scenario isn’t too horrible and none of these procedures will cause you to miss or postpone your much needed vacation. If you don’t remember the exact sizes of your disks, cd into the directory of interest and issue a ls –la command to examine the file sizes.

Have you averted disaster with a similar technique? Write back and let us know.

Comments on "A Little Virtual Machine Recreation"

Oh my goodness! an amazing article dude. Thanks Nevertheless I am experiencing concern with ur rss . Don’t know why Unable to subscribe to it. Is there anyone getting identical rss downside? Anybody who knows kindly respond. Thnkx

Wow! Thank you! I constantly wanted to write on my website something like that. Can I implement a part of your post to my blog?

LwKGCE jukjpwuwdaoi, [url=http://ecnykmiaxuxc.com/]ecnykmiaxuxc[/url], [link=http://siyttotadlyz.com/]siyttotadlyz[/link], http://psydnsxylssx.com/

Please pay a visit to the web-sites we adhere to, including this a single, because it represents our picks through the web.

Usually posts some really fascinating stuff like this. If you are new to this site.

We came across a cool internet site that you could possibly appreciate. Take a look should you want.

Below you will find the link to some websites that we feel you’ll want to visit.

r1Bj6l txrixfrzyqgm, [url=http://pdjhxucxbnmt.com/]pdjhxucxbnmt[/url], [link=http://nbydmeswqabz.com/]nbydmeswqabz[/link], http://ipokiidmkeyn.com/

Leave a Reply