If there is a large difference between the amount of data stored by the VM and the space consumed by the virtual disk file it could be worth to reclaim the space. The thin disks will start very small and grow as data is added within the VM, however if data is logically deleted inside the VM the thin disk will not shrink. So you can just storage vmotion back afterwards and you have reclaimed the lost disk space.How to reclaim disk space from virtual machines with thin virtual disks in VMware vSphere. On moving using storage vmotion, the zero data is already being discarded. Your solution is to either move the vmdk by hand to storage not located on VMFS or use storage vmotion to migrate to non NFS storage. The error is a bit confusing as you might expect vmkfstools to talk about the guest OS here, but it is actually reporting that NFS does not support the punchzero option. If you try to run this command against a VM living on NFS storage you might end up seeing the following error: You can also use the vSphere Client data browser to see the effect of reclaiming disk space. If you use the command du however then you can see the difference: rw- 1 root root 10.0G Nov 27 20:58 disk-flat.vmdk
VmfsDisk: 1, rdmDisk: 0, blockSize: 1048576Īfter you're done and list the VM from within the console, it looks like nothing has changed, in this example the disk is 10GB in size. Some more detailed descriptions and tips on zero-ing out data from your guest OS can be found at Shrink guest on hosted platform Note of warning that you should stop database -and other disk intensive- services before running the above. Note that the -z option is needed as of sdelete version 1.6įor a linux based VM, run a command like:Ĭat /dev/zero > zero.fill sync sleep 1 sync rm -f zero.fill Note that this will only work if your virtual disk is of type thin.īefore running it you will also need to zero out the unused blocks of data in the guest OS.įor a windows VM, you can use Microsoft's tool sdelete. Reclaim disk space by returning unused blocks of data in the virtual disk to the host OS. With the guest shut down you can run vmkfstools with the punchzero option. Since vSphere 5.1 there's an option to shrink disks besides the normally required storage vmotion. This is also what vSphere HA uses to see if a host is still active.
Vmkfstools windows 10 mac#
# vmkfstools -activehosts /vmfs/volumes/esx4-1-local-storage-1/įound 1 actively heartbeating hosts on volume '/vmfs/volumes/esx4-1-local-storage-1/'ĭisplays the MAC address of the management interface of each host which is currently using the datastore. Len 1260, nb 1 tbz 0, cow 0, zla 1, bs 1048576Īctivehosts can be used by specifying "-activehosts" and specifying a VMFS volume # vmkfstools -D /vmfs/volumes/esx4-1-local-storage-1/ ´getuuid´ option displays the UUID of the virtual disk.ĭumpfs can be used by specifying either "-D | -dumpfs" and specifying a VMFS volume, file or folder. Please make sure that the virtual disk does not have a UUID before using this option. If the descriptor file already contains a UUID, it will be overwritten with a new one.
'setuuid´ option creates a unique identifier (UUID) for the virtual disk and stores the UUID in the descriptor file of the Vmkfstools -fix check /vmfs/volumes/esx4-1-local-storage-1/dummy/dummy.vmdk This option will check and/or repair the virtual disk in case of an unclean shutdown. Vmkfstools -i /vmfs/volumes/storagename/YourVM/YourVM.vmdk -d 2gbsparse /vmfs/volumes/storage2/YourVM/YourVM.vmdkĬheck or repair a disk -x, -fix.
Vmkfstools windows 10 driver#
OPTIONS FOR DEVICES -L -lock /vmfs/devices/disks/.Įxport a VM disk in 2GB chunks, note that since ESXi 5.1+ the 2GB sparse driver is disabled. z -createrdmpassthru /vmfs/devices/disks/. OPTIONS FOR VIRTUAL DISKS vmkfstools -c -createvirtualdisk # OPTIONS FOR FILE SYSTEMS vmkfstools -C -createfs The command is mostly known for using it to manipulate virtual disks.īeware that if you are working with a virtual disk that in most cases the virtual machine itself should be shut down. Whereby target can be either a physical disk, a virtual disk or a device.