Inspiration for today’s article is a fantastic documentation of the vmkfstools founded here: https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.storage.doc/GUID-0AC9C948-4D0A-4634-99B8-E10CC09EFE47.html
vmkfstools is a cli command you can find on every ESXi host. As with everything but you always need to be careful when using it because you can potentially easily delete or mess around with your virtual system files.
But from the other side, it is a really powerful, irreplaceable command.
vmkfstools in vsphere version 7 looks like it is on steroids.
Again, you can find most of the info in VMware doc but I just wanted to point out some of the most important information to start with this tool.
First of all, the file/disk type you can operate is zeroedthick, eagerzeroedthick, thin, rdm (virtual mode rdm), rdmp (physical compatibility rdm), 2gbsparse.
The last disk type, 2gbsparse you need to convert, when you are migrating virtual system from workstation (ie VMware fusion, windows VMware workstation) to ESXi. Such can’t be easily migrated as VM can’t start with 2gbsparse.
Since I mention about converting, the following command can be used:
vmkfstools -i OLD_DISK -d NEW_DISK_TYPE NEW_DISK
, where:
- OLD_DISK – is the full path to the disk you want to clone WITH the disk itself
- NEW_DISK – is the full path to the output disk
- NEW_DISK_TYPE is one of the following:
- thin
- zeroedthick
- eagerzeroedthick
- rdm:device
- rdmp:device
- 2gbsparse
Some additional information can be found: https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.storage.doc/GUID-01D3CF47-A84A-4988-8103-A0487D6441AA.html
Above command should be used above the “unix” style cp command, as cp will always create a non-thin disk and is not optimized.
Other most frequently used option will be to rename disk:
vmkfstools -E OLD_DISK NEW_DISK
→ please just remember about the full path. It is valid everywhere in this document.
Remove disk (be carefull, as this command will not ask twice):
vmkfstools -U DISK
Change file to thin format with:
vmkfstools -K DISK
This command will remove all zero blocks. This means that before it could be worth cleaning and zeroing the OS file system. Another topic is UNMAP, that would be probably better option for you – but not always possible.
With option -x you can check filesystem (and repair it)
vmkfstools -x check(repair) DISK
Check the snapshot chain, to determine if any of the parietal snapshot are corrupted:
vmkfstools -e DISK
No Comments