For many years – oh as far back as ESX 2.x I’ve used the vmkfstools command to import/export .VMDK files as a crude form of backup/restore. This usage goes way back to the days when vCenter usage wasn’t mainstream and on the old ESX Admin I & II courses you used sysprep manually, before “exporting” the flat format into what was called back then the “COW” format (its now referred to more accurately as the 2gbsparse format). To day I had a problem with a long-standing VM that’s been in around my lab in some shape or form since those days. One of the nice things about vmkftools is it simplicity and the fact its been around for such a long time.

Sadly, I found the vmkfstools command returned an error. The error displays itself as an inability to locate the source file that I was trying to restore:

Failed to open ‘/vmfs/volumes/templates/backup/ts1/ts1.vmdk’: The system cannot find the file specified (25).
After tripple checking my paths; trying a different file; relocating the files to different datastore location – I was stumped. So it was time to use google to see if anyone had a similiar issue. I figured perhaps the syntax had subtly altered – as luck would have it I stumbled upon the exact same issue on the VMTN Forums – that goes to show how the forums are still a valuable resources even for an old-timer like me. The issue was on the vcbGhetto Forum over here:

http://communities.vmware.com/message/2143115

It turns out that vmkfstools with -i and -d 2gbsparse does work but the module that allows this behaviour is not longer enabled. To enable it on an ESXi host directly you need to load the module with:

esxcli system module load -m multiextent

Once this module is loaded then the vmkfstools at the ESXi host functions as normal. Apparently, this change of functionality is in the release notes. So I googled that http://www.vmware.com/support/vsphere5/doc/vsphere-esx-vcenter-server-51-release-notes.html

to check out what the statement says:

Clone or migration operations that involve non-VMFS virtual disks on ESXi fail with an error
No matter whether you use the vmkfstools command or the client to perform a clone, copy, or migration operation on the virtual disks of hosted formats, the operation fails with the following error message: The system cannot find the file specified.

Workaround: To perform a clone, copy, or migration operation on the virtual disks of hosted formats, you need to load the VMkernel multiextent module into ESXi.

  1. Log in to ESXi Shell and load the multiextent module.
    # vmkload_mod multiextent
  2. Check if any of your virtual machine disks are of a hosted type. Hosted disks end with the -s00x.vmdk extension.
  3. Convert virtual disks in hosted format to one of the VMFS formats.
    1. Clone source hosted disk test1.vmdk to test2.vmdk.
      # vmkfstools -i test1.vmdk test2.vmdk -d zeroedthick|eagerzereodthick|thin
    2. Delete the hosted disk test1.vmdk after successful cloning.
      # vmkfstools -U test1.vmdk
    3. Rename the cloned vmfs type disk test2.vmdk to test1.vmdk.
      # vmkfstools -E test2.vmdk test1.vmdk
  4. Unload the multiextent module.
    # vmkload_mod -u multiextent

So going forward…

I think its time for me to reconsider my usage of vmkfstools for this purposes, and opt for something more robust for achiving. Old habits diehard as they saying goes! 🙂