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.

Linux
Migrate WordPress site to another hosting service.

IntroductionThis article details the migration of WordPress site (exactly this site you are now on) from one service provider to Amazon Lightsail. There might be various reason to do that (mine is outlined below) but in general I hope to share the message that especially with WordPress, migration can be …

VMware
VMware Workstation and Fusion can be installed and use for free (even for the enterprise)

For a while now, the VMware Workstation (and Fusion for MacOS) can be used without any additional fee for Personal use. That was a great Broadcom news and nice gesture from that software vendor. Recently Broadcom announced that the software will be available for all, even the commercial sector. This …

Linux
Salt, VMware implementation – part 1, introduction

As every IT administrator knows, the infrastructure (meaning storages, compute, VMware virtualisation stack) is just a fundaments to run various operating systems (OS) and finally (containerized) application. Therefore, installation of (let’s call it) infrastructure in the datacenter (SDDC), in that sense is just the beginning of the adventure. No wonder, …