Submitted by admin on Sat, 09/25/2010 - 20:00
After losing some VmWare ESXi vmdk configuration files, I had to recover them somehow. Especially the ".vmdk" description files were corrupt. Actually I didn't even know the name or the disk size of the virtual hdd-s.
The way I recovered them was according to this site:
http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1002511
Desktop VmWare products also have this feature (http://www.vmware.com/pdf/VirtualDiskManager.pdf), but I wanted to try it with ESXi.
Some VmWare conventions:
- host: the VmWare player/server/workstation
- guest: virtual machines installed into the host
- desktop machine: my laptop where the VmWare host is installed
The following is the procedure:
- Download the FREE VmWare player and VmWare ESXi installers
- Install an ESXi server into my VmWare player.
- Enable the SSH maintenance port on the ESXi.
- Install the vSphere client to the desktop machine to be able to configure the ESXi guests.
- Copy the virtual disk vmdk-s to the ESXi datastore
- Login to the ESXi via SSH, go to the copied files with
cd /vmfs/volumes/datastore1/work
- Determine the size of the disks:
ls -l
- Execute the following command with custom parameters:
vmkfstools -c 4294967296 -a lsilogic -d thin temp.vmdkwhere the long number is the size of the virtual disk determined with "ls -l". The "lsilogic" can be determined from the ".vmx" file, which I did not have, so I guessed. The command generates "temp.vmdk"
- Download the "temp.vmdk" to desktop
- Edit it with Notepad++ and delete the following line: "
ddb.thinProvisioned = 1
". The virtual disk file name can be set in the file after "# Extent description" like "RW 8388608 VMFS "vmdisk0-flat.vmdk"
""
- Delete files from the datastore.
- Create a virtual machine in VmWare player with custom settings and when it asks for creating a new virtual disk, select to "use an existing virtual disk" option and choose your new "temp.vmdk". Of course you can rename it.
- Play the machine.