Skip to content

Instantly share code, notes, and snippets.

@psammarco
Created November 14, 2018 23:13
Show Gist options
  • Select an option

  • Save psammarco/283d95ff36b0b6d136f10e66c13b094b to your computer and use it in GitHub Desktop.

Select an option

Save psammarco/283d95ff36b0b6d136f10e66c13b094b to your computer and use it in GitHub Desktop.
This was tested on ESXi 6.5, but should work from 5 onwards.
The descriptor is basically a text file that contains geometry parameters which point out to the image that actually cotain the data,
usally called "VM0-flat.vmdk".
This is a last resort method when unable to restore the actual descriptor .vmdk file.
1) SSH into your ESXi host and head to /vmfs/volumes/datastore/VM
>>>
# ls -l virt_switch0-flat.vmdk
-rw------- 1 root root 2147483648 Nov 14 21:57 virt_switch0-flat.vmdk
<<<
2) Create the new descriptor file using the file size of the .vmdk image containing the data
>>>
# vmkfstools -c 2147483648 -d thin temp.vmdk
<<<
3) As result of this a temp-flat.vmdk file will be created, delete it!
>>>
# rm -r temp-flat.vmdk
<<<
4) Remaning temp.vmdk to the actual descriptor's file name ESXi is nagging about
>>>
# mv temp.vmdk virt_switch0-000001.vmdk
<<<
5) Lastly, edit the newly created descriptor file and rename the following
{ RW 4194304 VMFS "temp.vmdk" }
to
{ RW 4194304 VMFS "virt_switch0-flat.vmdk" }
6) Also remove { ddb.thinProvisioned = "1" } if the virtual disk uses thick
Done.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment