vmkfstools - vSphere CLI for managing VMFS volumes.


 vmkfstools <conn_options> <options> <target>

If <target> is a file system, <options> can be one of the following:

 --createfs [blocksize]kK|mM --setfsname <fsname>
 --extendfs <span_partition> <head_partition>

If <target is a virtual disk, <options> can be one of the following:

     --adaptertype <type>
     --diskformat <format> <location> 
 --renamevirtualdisk <oldName> <newName> 


You use the vmkfstools vSphere CLI to create and manipulate virtual disks, file systems, logical volumes, and physical storage devices on an ESX/ESXi host. You can use vmkfstools to create and manage a virtual machine file system (VMFS) on a physical partition of a disk and to manipulate files, such as virtual disks, stored on VMFS-3 and NFS. You can also use vmkfstools to set up and manage raw device mappings (RDMs).




Specifies the target server and authentication information if required. Run vmkfstools --help for a list of all connection options.


Prints a help message for each command-specific and each connection option. Calling the script with no arguments or with --help has the same effect.

--vihost | -h <esx_host>

When you execute a vCLI with the --server option pointing to a vCenter Server system, use --vihost to specify the ESX/ESXi host to run the command against.


--createfs | -C vmfs3 -b | --blocksize -S | --setfsname <fsName> <partition>

Creates a VMFS3 file system on a specified partition, such as naa.<naa_ID>:1. The specified partition becomes the file system's head partition.

--blocksize | -b

Specifies the block size of the VMFS file system to create. When omitted, defaults to using 1MB.

--setfsname | -S

Name of the VMFS file system to create.

--spanfs | -Z <span_partition> <head_partition>

Extends the VMFS file system with the specified head partition by spanning it across the partition specified by <span_partition>.

--queryfs | -P <directory>

Lists attributes of a file or directory on a VMFS volume. Displays VMFS version number, the VMFS file system partitions, the capacity and the available space.


--createvirtualdisk | -c <size> -a | --adaptertype <srcfile> -d | --diskformat <location>

Creates a virtual disk at the specified location on a VMFS volume. With <size> you can specify specify k|K, m|M, or g|G. Default size is 1MB, default adapter type is 'busLogic', and default disk format is 'zeroedthick'.

--adapterType | -a [buslogic|lsilogic|ide]

Adapter type of a disk to be created. Accepts buslogic, lsilogic or ide.

--diskformat | -d

Specifies the target disk format when used with -c, -i, or -X.

For c, accepts zeroedthick, eagerzeroedthick, or thin.

For i, accepts zeroedthick, eagerzeroedthick, thin, rdm:dev, rdmp:dev, or 2gbsparse.

For -X, accepts eagerzeroedthick.

--clonevirtualdisk | -i <src_file> <dest_file> --diskformat | -d <format> --adaptertype | -a <type>

Creates a copy of a virtual disk or raw disk. The copy will be in the specified disk format. Takes source disk and destination disk as arguments.

--deletevirtualdisk | -U <disk>

Deletes files associated with the specified virtual disk.

--renamevirtualdisk | -E <old_name> <new_name>

Renames a specified virtual disk.

--extendvirtualdisk | -X [-d eagerzeroedthick]

Extends the specified VMFS virtual disk to the specified length. This command is useful for extending the size of a virtual disk allocated to a virtual machine after the virtual machine has been created. However, this command requires that the guest operating system has some capability for recognizing the new size of the virtual disk and taking advantage of this new size (e.g. by updating the file system on the virtual disk to take advantage of the extra space).

On ESX/ESXi 4.0 and later, you can use -d | --diskformat to specify that the disk should grow in eagerzeroedthick format. You can use -d only with eagerzeroedthick. By default, any disk, regardless of format, is extended as zeroedthick. Extending disks to eagerzeroedthick makes sense only when these virtual disks are used for fault tolerance or clustering and have to be preallocated and zeroed out up front.

--createrdm | -r <rdm_file>

Creates a raw disk mapping, that is, maps a raw disk to a file on a VMFS file system. Once the mapping is established, the mapping file can be used to access the raw disk like a normal VMFS virtual disk. The 'file length' of the mapping is the same as the size of the raw disk that it points to.

--createrdmpassthru | -z <device> <map_file>

Creates a passthrough raw disk mapping. Once the mapping is established, it can be used to access the raw disk like a normal VMFS virtual disk. The 'file length' of the mapping is the same as the size of the raw disk that it points to.

--querydm | -q

This option is not currently supported.

--geometry | -g

Returns the geometry information (cylinders, heads, sectors) of a virtual disk.

--writezeros | -w

Initializes the virtual disk with zeros. Any existing data on the virtual disk is lost.

--inflatedisk | -j

Converts a 'thin' virtual disk to 'eagerzeroedthick'. Any data on the 'thin' disk is preserved. Any blocks that were not allocated are allocated and zeroed out.


The following examples assume you are specifying connection options, either explicitly or, for example, by specifying the server, user name, and password. Run vmkfstools --help for a list of common options including connection options. The examples use single quotes around some names; use double quotes on Windows.

Create the specified file system:

For ESX/ESXi version earlier than 4.0, specify the VMHBA name:

  vmkfstools <conn_options> -C vmfs3 -b 1m -S Test vmhba0:0:0:3

For ESX/ESXi version 4.0 or later, specify the device name, for example

  vmkfstools <conn_options> -C vmfs3 -b 1m -S Test naa.600601604d521c002732ff0dc122dd11:3

Create a virtual disk:

  vmkfstools <conn_options> -c 2048m '[storage1] rh6.2.vmdk'

Rename files associated with a specified virtual disk to the specified name:

  vmkfstools <conn_options> -E '[storage1] rh6.2.vmdk' '[storage1] testing2.vmdk'

Get the geometry information (cylinders, heads, and sectors) of a virtual disk:

  vmkfstools <conn_options> -g '[storage1] testing2.vmdk'

Delete an existing virtual disk:

  vmkfstools <conn_options> -U '[storage1] testing2.vmdk'

Shrink the size of the virtual disk:

 vmkfstools <conn_options> -s '[storage1] rh6.2.vmdk'

Extend the virtual disk to specified size, the extended region of the disk grows in eagerzeroedthick format:

 vmkfstools <conn_options> -X 1g -d eagerzeroedthick '[storage1] rh6.2.vmdk'

Initialize the virtual disk with zeros:

 vmkfstools <conn_options> -w '[storage1] rh6.2.vmdk'