Memorise

VMware ESX VM Resurrection from flat.vmdk file

Recreating a missing .vmdk descriptor file on ESX.

Access the ESX command line and navigate to the virtual disk (you can use putty)
list the file in Virtual Machines directory:
[root@esx03 ONLINEBACKUP]# ls -ltr *.vmdk

you should see something like
-rw——- 1 root root 107374182400 Jul 19 07:32 ONLINEBACKUP-flat.vmdk
[root@esx03 ONLINEBACKUP]# less *.vmx | grep -i virtualdev
ethernet0.virtualDev = “e100”

so here its usuing “lsilogic”
next piece of information is exact size of the flat .vmdk file. to identify the sexact size of the flat. vmdk virtual disk:
ls -l *.-flat.vmdk
should see something like

-rw——- 1 root root 107374182400 Jul 19 07:32 ONLINEBACKUP-flat.vmdk

but the .vmdk desctiptor file missing.
two piece of information we need to recreate this missing file,
1) type of scsi controller and
2) vmdk file size

identify the scsi controller type in use by the virtual disk: less *.vmx | grep -i virtualdev
you shold see something like

scsi0.virtualDev  = “lsilogic”

-rw——- 1 root root 107374182400 Jul 19 07:32 ONLINEBACKUP-flat.vmdk

in this case the file size is 107374182400
now we need to use the vmkfstools command to create a temporary virtual disk (flat.vmdk) and as associated .vmdk descriptor file

use the command: vmkfstools -c filesize -a scsi type -d thin filename.vmdk so for my example it will look like this

vmkfstools -c 107374182400 -a lsilogic -d thin temp.vmdk

so now we have a tem.vmdk file exact size as -flat.vmdk with all the associated files, just to check:
ls -ltr *.vmdk

this will list temp descriptor .vmdk file which we will now use to resolve the issue.
rename the temp.vmdk file to match the problem -flat.vmdk to do this use:
mv temp.vmdk ONLINEBACKUP.vmdk

now we need to change the descriptor file, we need to edit the desctiptor file to now point to the correct -flat.vmdk file

use:vi ONLINEBACKUP.vmdk

the part you need to change is Extent description and replace them temp-flat.vmdk with correct filename-flat.vmdk in my example it will be ONLINEBACKUP.vmdk and save changes.

there is one more part you need to check if the original vmdk was thin provisioned, if the original -flat file was not think provisioned the remove the line from desctiptor title “dd.thinProvisioned = “1”

you can verify if the original was thin provisioned or not by:
du -h *.vmdk

take a not of the temp-flat.vmdk and original vmdk file.
that should do the trick. start the VM.

 

 



Categorised as: Virtual Infrastructure, VMWare/ESX


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.