<

Rebuilding a VMware VMDK from Scratch

Published on
11,731 Points
5,631 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Join & Write a Comment

Teach the user how to use configure the vCenter Server storage filters Open vSphere Web Client:  Navigate to vCenter Server Advanced Settings: Add the four vCenter Server storage filters: Review the advanced settings: Modify the values of the four v…
Teach the user how to install log collectors and how to configure ESXi 5.5 for remote logging Open console session and mount vCenter Server installer: Install vSphere Core Dump Collector: Install vSphere Syslog Collector: Open vSphere Client: Config…

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month