vmkfstools – command options

  • By :
  • Category : VMware

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

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Free(BSD)
Search for duplicated files

This will be short (but hopefully I will find more time to show entire process to search duplicated files together with some examples). In case you are searching for duplicated files I can recommend two software which actually rocks in openSource world

Azure
NFS issue, cannot be mounted or is not visible

The same kind of issue I have encountered numerous times while working across different environments and with various customers. The problem with NFS mounts connected from remote locations is so common. This issue extends beyond communication solely over WAN and also include connections between datacenters (DC) where we lack control …

Azure
Why Firefox is important and people should use this browser in 2024, my thoughts.

Can you remember the times when everyone was using Internet Explorer? Back in the ’90s and the early part of this century, Internet Explorer dominated the browser market. Software Incompatibility with Other Browsers Incompatibility issues with software and other browsers have been a persistent problem. Even in 2022, this remains …