Thursday, January 19, 2012

Importing VMware flat.vmdk file

Someone sent me a file today and told me to import it into VMware. I looked at it briefly and noticed that it was a single file named server-flat.vmdk.
Normally VMware uses multiple files, a VMX, a VMDK, and a -FLAT.VMDK, but here I was just given the one. The FLAT file contains all the disk, so this was the most important file. But the other files are descriptors that tell VMware how to use the disk - What OS, what controller, disk geometry, etc...

A little googling and I found my solution at http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1002511. The basic steps are below:

  1. Import the VMDK file to a datastore
  2. Create a VM with the OS and RAM characteristics needed - dont create/attach a disk
  3. Putty to an ESX host
  4. Find the datastore the VMDK was imported into and do an LS -LA to view the file size in bytes
  5. In the VM folder, run  vmkfstools -c 4294967296 -a lsilogic -d thin temp.vmdk
    1. The size, name, and controller type will vary
  6. Delete the new -FLAT.VMDK file
  7. Move the original -FLAT.VMDK file into this folder
  8. Add the newly created VMDK to the VM

No comments: