Vmkfstools -t0 /vmfs/volumes/datastore1/MartinWIN7/MartinWIN7.vmdkĮxample Output, the ‘ VMFS Z‘ indicates that it is lazy zeroed (zeroedthick): Vmkfstools -i src dst -d –diskformat -a –adaptertype Ĭhecking the Disk format using ‘vmkfstools -t0’ before cloning ‘MartinWIN7.vmdk’: Thin – only the required space is allocated the remainder is allocated and zeroed over time on demand. Zeroedthick (default) – all space is allocated during creation but only zeroed on first write, referred to a lazy zeroed.Įagerzeroedthick – all space is allocated and fully zeroed during creation. You can chose the Disk format by using the -d –diskformat suboption. Where src is the current vmdk location (‘datastore1’) and dst is the destination (‘datastore2’) where you would like the vmdk file copied to. The ‘-i’ option used with vmkfstools creates a copy of a virtual disk, using the following syntax: Change directory to the new VMFS volume where the VM will be migrated to and create a new folder for the VM files:Ĩ.Using the ‘vmkfstools’ command to clone the VM to ‘datastore2’, once the cloning process has completed successfully then we can delete the original VM on ‘datastore1’. If the size displayed by a *.vmdk was zero this would imply the vmdk was a Thin disk and the *-flat.vmdk would display the actual used space of the Thinly provisioned vmdk, something similar to the following:Īs you can see below each VM Disk has a flat file and a descriptor file, for example the virtual machine ‘MartinWIN7’ has a disk named MartinWIN7.vmdk and a corresponding MartinWIN7-flat.vmdk file.ħ. You can view the actual amount of space used by the vmdk files on ‘datastore1’ by using the cmd: du -ah Change directory to the VMFS volume where the VM currently resides (‘datastore1’) and gather the required information such as vmdk and vmx file names: List the VMFS Volumes available on the ESXi host:Ħ.
How to gather the world_id: esxcli vm process listĥ. Or using esxcli: esxcli vm process kill –w world_id Shutdown the virtual machine with the command: Shutdown the virtual machine ‘MartinWIN7’ VMID ‘9’:Ĭheck the power state of the virtual machine with the following command: If necessary remove the snapshot: vim-cmd vmsvc/snapshot.remove 9ģ. We can see from the output that the inventory ID for this VM is ‘9’Ĭheck if VMID ‘9’ has a snapshot: vim-cmd vmsvc/get.snapshot 9 List the inventory ID of the virtual machine ‘MartinWIN7’ which is being migrated to the new datastore: Log into the ESXi host as ‘root’ via SSH.Ģ.
Note: Before proceeding ensure no snapshots are present on the VM being migrated.ġ. In this example a second RAID1 Mirror has been added to a standalone DELL Server and a new VMFS datastore has been created labelled ‘datastore2’: In this case you may use the vSphere VI Client datastore browser and copy/move the VM data files from one datastore to another or in the case outlined here you may use the CLI approach to migrate a specific VM to another datastore.
You may encounter a scenario where a vCenter server is not part of a solution and SVMotion is not an option to migrate a VM from one VMFS datastore to another.