Virtual Disk Damaged? – Basic VMDK Repair

by bunchc on November 25, 2008

You’ve got redundant power, a UPS, redundant hosts, redundant networking, etc. Yet despite your best efforts to make things solid, something happens. Disks get corrupt, files go away, Chuck Norris divides by zero, and in general “Bad Things” happen. What do you do when these “Bad Things” happen in the virtual world?

Despite the inherent flexibility in virtual machines, they still have to live somewhere. What do you do when that gets corrupt?

I was led to this by a post on the Linked-In VCP Group. It is a basic “How To” for fixing basic VMDK corruption.

The VMDK or set of VMDK’s on ESX is made up essentially of 2 files, the vmdk and the *-flat.vmdk. The vmdk itself is just plain text pointer to the *-flat.vmdk, where * is the name of the VM. Should the .vmdk of a VM have gone corrupt, and you are not able to start the VM, the following should help:

1) Make a backup copy of the original VMDK (the pointer)
2) Make a copy of the pointer VMDK from another VM on the system
3) Edit the relevant fields and save
4) Boot the VM

Sounds easy, no? The hard part is getting the Cylinders, Sectors, and Heads for the size of your *-flat.vmdk correct. This website (http://sanbarrow.com/vmdk/diskgeometrietable2.html) should help with that. The resulting file should look similar to:

version=1
CID=ed3d02ab
parentCID=ffffffff
createType=”vmfs”

RW 1069547520 VMFS ” exisiting-server-flat.vmdk”

#DDB
ddb.virtualHWVersion = “4″
ddb.uuid = “60 00 C2 90 c2 f2 8d d4-0f 36 a2 46 de 22 61 6e”
ddb.geometry.cylinders = “66576″
ddb.geometry.heads = “255″
ddb.geometry.sectors = “63″
ddb.adapterType = “buslogic”

In lamens terms that equates to:

510GB 522,240MB 1069547520 Sectors SCSI 66576-255-63

Technorati : , , , , ,
Del.icio.us : , , , , ,
Zooomr : , , , , ,
Flickr : , , , , ,

  • Rosanna Costa

    nice article! nice site. you're in my rss feed now ;-)
    keep it up

  • http://www.facebook.com/profile.php?id=6305737 Jonathan Somers

    Why does every problem always link to your blog

  • http://www.facebook.com/AGUSTIN.RUDAS Agustin Rudas

    Very usefull thanks.

Previous post:

Next post: