<

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x

Rebuilding a VMware VMDK from Scratch

Published on
11,836 Points
5,736 Views
1 Endorsement
Last Modified:
Approved
This type of situation occurs when you either accidently delete a vmdk and have only a xxxx-flat.vmdk file or if you had a second machine attached to a disk and delete that machine it details the details of the disk. You cannot mount a xxxx-flat.vmdk file to any virtual machine because the machine has no idea how to manage the disk. So you can no longer attach the disk or boot the VM it is attached too. The very first step is to remove the original disk from the machine so there is no way to power on or essentially damage the files. Verify you can still boot the VM successfully but minus the disk (if it was not the primary disk). If you have no disk space to re-create a mirror of this disk (in order to copy the vmdk settings into the problematic file) disk to pull the .vmdk file from and point it to the xxxx-flat.vmdk file so you can create an any size virtual disk on the specified machine and attached it to the xxxx-flat.vmdk and then calculate the the Cylinders, Sectors, and Heads for the original  xxxx-flat.vmdk. I found a excellent website to assist the calculations:

This website will give you the calculations you need.
http://sanbarrow.com/vmdk/diskgeometrietable2.html

This example is of a 510gb disk that was deleted and used a 40gb disk to recreate the xxxx.vmdk I needed. From here I was able to re-create the .VMDK file for the virtual disk as follows (the original):

version=1
CID=ed3d02ab
parentCID=ffffffff
createType= vmfs 
RW 83886080 VMFS old-server-flat.vmdk 
#DDB
ddb.virtualHWVersion = 43
ddb.uuid = 60 00 C2 90 c2 f2 8d d4-0f 36 a2 46 de 22 61 6e 
ddb.geometry.cylinders = 52213
ddb.geometry.heads = 2553
ddb.geometry.sectors = 633
ddb.adapterType = buslogic 

Open in new window


The new .VMDK file:
version=1
CID=ed3d02ab
parentCID=ffffffff
createType= vmfs 
RW 1069547520 VMFS exisiting-server-flat.vmdk 
#DDB
ddb.virtualHWVersion = 43
ddb.uuid = 60 00 C2 90 c2 f2 8d d4-0f 36 a2 46 de 22 61 6e 
ddb.geometry.cylinders = 665763
ddb.geometry.heads = 2553
ddb.geometry.sectors = 633
ddb.adapterType = buslogic

Open in new window


You can see that the geomotry of the disk changed to reflect the actual listed in VMware when referring to the machine and its attached disks. The most important part is to update the pointer to reflect the xxxx-flat.vmdk file that was the problem. You will notice if you look at the datastore now that the xxxx-flat.vmdk is now hidden and only the xxxx.vmdk is showing. This means you corrected the problem and now you can attach the disk back to the virtual machine. Either complete this step while the machine is running or turn it off and mount it. Anyway you do it, you will be happy that you restored your disk.
1
Comment
Author:kmlmustang
1 Comment

Administrative Comment

by:Articles101
I've asked for another Page Editor to review the article from a technical viewpoint
0

Featured Post

Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.

Join & Write a Comment

Teach the user how to delpoy the vCenter Server Appliance and how to configure its network settings Deploy OVF: Open VM console and configure networking:
This Micro Tutorial walks you through using a remote console to access a server and install ESXi 5.1. This example is showing remote access and installation using a Dell server. The hypervisor is the very first component of your virtual infrastructu…

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month