vmdkdtool - A tool to create or repair virtual disk header files.

by forgette Former NetApp Employee on ‎2009-04-02 08:10 PM - edited on ‎2014-09-25 11:35 AM by allison Former NetApp Employee
Narrative

 

The virtual disk in ESX 3.x environments is made up of 2 files.  A descriptor, or header file and an image file (normally ends in -flat.vmdk).   A missing or corrupted descriptor file can cause various errors.  This tool examines the descriptor file (if present) and verifies that the geometry values are valid for image file it describes.  If the values are incorrect, it offers the user the ability to fix them.  If the user chooses to fix the descriptor file, a backup of the original is made first.  If the descriptor file is not present, the tool offers the user the ability to create one based on the image file.

 

I hope you find this tool useful.  Please post any issues in the comments below and I'll try to address them as time allows.

Cheers,

-Eric

 

 

Description

 

This unsupported tool implements the 'Creating a header for an ESX 3 virtual machine' resolution documented in kb article 1004232.  It can also repair the virtual geometry and length fields of an existing header (sometimes referred to as a descriptor) file.

 

Installation instructions:

1.) Copy the zip file to an ext3 filesystem on an ESX 3.5 service console.

 

2.) Unzip the file using the following command:

 

unzip vmdkdtool.zip

 

3.) Make use the tool is in the root user’s path.

 

 

To verify a descriptor file:
[root@x3 root]# vmdkdtool /vmfs/volumes/test/testvm/fixed-template.vmdk
vmdkdtool version 1.0.090402.
Copyright (c) 2009 NetApp, Inc.
All rights reserved.

 

/vmfs/volumes/test/testvm/fixed-template-flat.vmdk is 12884902400 bytes (12.0000004768372 GB)
size       = 25165825 (current 25165825)
sectors    = 63 (current value 63)
heads      = 255 (current value 255)
cylinders  = 1566 (current value 1566)
The descriptor file appears to be correct.

 

To fix a corrupt descriptor file:
[root@x3 root]# vmdkdtool /vmfs/volumes/test/testvm/fixed-template.vmdk
vmdkdtool version 1.0.090402.
Copyright (c) 2009 NetApp, Inc.
All rights reserved.

 

/vmfs/volumes/test/testvm/fixed-template-flat.vmdk is 12884902400 bytes (12.0000004768372 GB)
size       = 25165825 (current 25125)
sectors    = 63 (current value 21)
heads      = 255 (current value 3)
cylinders  = 1566 (current value 106)

 

NOTE: A backup of the file will be made if you choose yes.

 

Shall I fix the descriptor file? yes
Creating a backup of /vmfs/volumes/test/testvm/fixed-template.vmdk
Fixed.

 

To create a descriptor file:
[root@x3 root]# vmdkdtool /vmfs/volumes/test/testvm/fixed-template-flat.vmdk
vmdkdtool version 1.0.090402.
Copyright (c) 2009 NetApp, Inc.
All rights reserved.

 

/vmfs/volumes/test/testvm/fixed-template-flat.vmdk is 12884902400 bytes (12.0000004768372 GB)
size       = 25165825 (current 0)
sectors    = 63 (current value 0)
heads      = 255 (current value 0)
cylinders  = 1566 (current value 0)

 

Unable to find /vmfs/volumes/test/testvm/fixed-template.vmdk.

 

Shall I create the descriptor file based on /vmfs/volumes/test/testvm/fixed-template-flat.vmdk? yes
Created /vmfs/volumes/test/testvm/fixed-template.vmdk.
Comments
forgette Former NetApp Employee

The original VMware kb article has been replaced.  The original version of the article indicated that these values did not need to 'add up'.  The CHS addressing hasn't been meaningful in physical drives for quite some time, the same is true here.

I have an esxi that was installed on a raid 5 and 2 disks failed, I had to reconstruct the raid and recovred all the VMs, a lot of them with lost info but recovered most of what I need so far but there is a very important VM that is failing to start, i suspect there is corruption in its geometry. The virtual machine has a snapshot, the original flat disk is ok I can mount it and browse through it on a ubunntu live disk ok but the snapshot which contains all of my info is the one that is failing to read. When I try to clone it is fails at 0%, definately the descriptior issue.

At this stage all I care about is salvaging whatever information I can from that snapshot, the files and maybe the mysql database files, I have downloaded your vmdktool and uloaded it to esxi and tried to run it but not luck I get the following error:

Panic: Cannot determine full path of './vmdkdtool'

Please help me, I have spent over 3 weeks so far trying to salvage 2tb odf data, I would hate to fail at this point.

Thank you

forgette Former NetApp Employee

The tool does not work in ESXi.  You're best bet is to follow VMware's kb1002511.

Warning!

This NetApp Community is public and open website that is indexed by search engines such as Google. Participation in the NetApp Community is voluntary. All content posted on the NetApp Community is publicly viewable and available. This includes the rich text editor which is not encrypted for https.

In accordance to our Code of Conduct and Community Terms of Use DO NOT post or attach the following:

  • Software files (compressed or uncompressed)
  • Files that require an End User License Agreement (EULA)
  • Confidential information
  • Personal data you do not want publicly available
  • Another’s personally identifiable information
  • Copyrighted materials without the permission of the copyright owner

Files and content that do not abide by the Community Terms of Use or Code of Conduct will be removed. Continued non-compliance may result in NetApp Community account restrictions or termination.