vmkfstools Manual

VMKFSTOOLS VMware ESX Manual VMKFSTOOLS

NAME
vmkfstools – VMware ESX file system management tool

SYNOPSIS
vmkfstools OPTIONS
vmkfstools OPTIONS PARTITION
vmkfstools OPTIONS DEVICE
vmkfstools OPTIONS PATH

COPYRIGHT
VMware ESX is Copyright 1998-2009 VMware, Inc. All rights reserved.

DESCRIPTION
vmkfstools is a program for creating and manipulating virtual disks, file systems, logical volumes and physical storage devices on the VMware ESX.
It supports the creation of VMware ESX File System (VMFS) on a partition of a disk, and the management of files (such as virtual disks) stored on
VMFS.

OPTIONS is one or more command-line options that specify the operation. The file or VMFS file system being manipulated may be specified after the
options by a relative or absolute file path name in the /vmfs hierarchy.

The disk partition target is specified using a vml.😛 where is the device ID returned by the storage array and P is an integer
that represents the partition number. The partition digit must be greater than zero and should correspond to a valid VMFS

The DEVICE argument is used for specifying devices, and should be a path name beginning with /vmfs/devices, which is the mount point of the device
file system. There are sub-mounts for each device class. For example, /vmfs/devices/disks for local or SAN-based disks, /vmfs/devices/lvm for VMK-
ernel logical volumes, /vmfs/devices/generic for generic SCSI devices like tape drives, etc.

The PATH argument is used for specifying a VMFS file system or file, and should be an absolute or relative path that names a directory or a file
under /vmfs. For example, a VMFS file system could be specified via a path such as:

/vmfs/volumes/ or /vmfs/volumes/

A VMFS file would be specified via a path such as:

/vmfs/volumes//[dir]/myDisk.vmdk or myDisk.vmdk

if the current working directory is the parent directory of myDisk.vmdk.

FILE SYSTEM OPTIONS
The long and short forms of options, shown here listed together, are equivalent.

-C, –createfs vmfs3
-b, –blocksize #[mMkK]
-S, –setfsname fsName
Create a VMFS file system on the specified partition,
e.g. vml.:1. The partition becomes the file systemâs head
partition. The file block size can be specified via the ´-b´
option. The default file block size is 1MB. The file block size
must be either 1MB, 2MB, 4MB or 8MB.
Note: VMFS-2 file system is not supported on vSphere versions 4.1
or higher.

The -S option sets the label of the VMFS file system, and can only
be used in conjunction with the ´-C´ option. This label can then
be used to specify a VMFS file system in subsequent vmkfstools
commands or in a virtual machine configuration file. The label
will also appear in a listing produced by ´ls -l /vmfs/volumes´
as a symbolic link to the VMFS file system. VMFS labels can be up
to 128 characters long. They cannot contain leading or trailing
spaces. After creating the file system, the label can be changed
using the command ´ln -sf /vmfs/volumes/
/vmfs/volumes/´.

-Z, –spanfs span-partition
Extend the VMFS-3 file system with the specified head
partition by spanning it across the partition designated by
´span-partition´. The operation erases existing data on the
spanned partition. A VMFS-3 file system can have at most 32
partitions.

-G, –growfs grow-partition
Extend the VMFS-3 file system with the specified ´grow-partition´.
Prior to growing the file system, users must use a tool such as
´fdisk´ or ´partedUtil´ to create or resize the partition first.
Once the partition size ´grow-partition´ is available, file
system can be grown by designating the ´grow-partition´ using the
option ´-G´. Existing data on the grow partition is preserved.

-P, –queryfs
-h, –human-readable
List the attributes of a VMFS file system when used on any file or
directory of a VMFS file system. It lists the VMFS version number,
the number of partitions constituting the specified VMFS file
system, the file system label (if any), file system UUID,
available space, and a listing of the device names of all the
partitions constituting the file system. If partitions backing
VMFS file system go offline then the number of partitions and
available space reported change accordingly. The ´h´ option
causes sizes to be printed in human-readable format (such as 5k,
12.1M, or 2.1G).

VIRTUAL DISK OPTIONS
-c, –createvirtualdisk #[gGmMkK]
-a, –adaptertype [buslogic|lsilogic|ide] srcFile
-d, –diskformat [thin|zeroedthick|eagerzeroedthick]
Create a virtual disk with the specified size on the VMFS file
system. The size is specified in bytes by default, but can be
specified in kilobytes, megabytes or gigabytes by adding a suffix
of ´k´, ´m´, or ´g´ respectively. The ´adaptertype´ option
allows users to indicate which device driver should be used to
communicate with the virtual disk. See the SUPPORTED DISK
FORMATS
section for details on the disk formats supported by
the ´-d´ option. The default disk format is ´zeroedthick´. The
-d eagerzeroedthick option is used to create a virtual disk
which are allocated with the contents zeroed out at creation time.

-U, –deletevirtualdisk
Delete files associated with the specified virtual disk.

-E, –renamevirtualdisk srcDisk
Rename files associated with a specified virtual disk to the
specified name.

-i, –clonevirtualdisk srcDisk
-d, –diskformat [zeroedthick|thin|eagerzeroedthick| rdm:|rdmp:|2gbsparse]
Create a copy of a virtual disk in specified disk format.
See the SUPPORTED DISK FORMATS´ section for details on the
disk formats supported by the ´-d´ option. The default disk
format is pre-allocated. To clone ESX REDO logs while preserving
their hierarchy, use the Service Console command ´cp(1)´.

-e, --exportvirtualdisk dstDisk
This operation is deprecated. Use ´-i srcDisk -d 2gbsparse´ to
achieve what it used to.

-X, --extendvirtualdisk #[gGmMkK]
Extend the specified VMFS virtual disk to the specified length.
Extending a virtual disk will invalidate any currently existing
snapshots. 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).

Caution: Extending a virtual disk will break any currently existing
snapshots.

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

-j, --inflatedisk
Convert a ´thin´ virtual disk to ´eagerzeroedthick´
disk with the guarantee that any data on the virtual disk is
preserved and any blocks that were not allocated get allocated and
zeroed out.

-k, --eagerzero
Convert a ´zeroredthick´ virtual disk to ´eagerzeroedthick´
disk with the guarantee that any data on the virtual disk is
preserved.

-M, --migratevirtualdisk
Migrate an ESX2 virtual disk to an ESX3 virtual disk.

-K, --punchzero
Convert any virtual disk format ´thin´ or ´zeroredthick´ or
´eagerzeroedthick´ to a ´thin´ disk with all blocks
which contain zeroed blocks deallocated. This option results in a
virtual disk consisting of only those blocks which have been
allocated and written with valid non-zero data.

-r, --createrdm /vmfs/devices/disks/...
Map a raw disk to a file on a VMFS file system. 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.

-q, --queryrdm
List the attributes of a raw disk mapping. When used with a
´rdm:´ or ´raw:´ specification, it prints out the
vml of the raw disk corresponding to the mapping
referenced by the . It also prints out identification
information for the raw disk (if any).

-z, --createrdmpassthru /vmfs/devices/disks/...
Map a passthrough raw disk to a file on a VMFS file system. This
allows a virtual machine to bypass the VMKernel SCSI command
filtering layer done for VMFS virtual disks. Once the mapping is
established, it can be used to access the passthrough raw disk
like a normal VMFS virtual disk.

-v, --verbose #
This option is ignored for the queryrdm option. Setting the
verbosity level will list additional information for the virtual disk
configuration.

-g, --geometry
Get the geometry information (cylinders, heads, sectors) of a
virtual disk.

-x, --fix -[check|repair]
This option will check and/or repair the virtual disk in case of an unclean shutdown.

-J, --miscop [setuuid | getuuid]
´setuuid´ option creates a unique identifier (UUID) for the
virtual disk and stores the UUID in the descriptor file of the
virtual disk. If the descriptor file already contains a UUID,
it will be overwritten with a new one. Please make sure that the
virtual disk does not have a UUID before using this option.
´getuuid´ option displays the UUID of the virtual disk.

SUPPORTED DISK FORMATS
These are the arguments that can be passed to the ´-d´ option for the ´-c´ (create virtual disk) and ´-i´ (clone virtual disk) operations.

zeroedthick
Space required for the virtual disk is allocated at creation time.
Any data remaining on the physical device is not erased during
creation, but will be zeroed out on demand at a later time on
first write from the virtual machine. The virtual machine does not
read stale data from disk.

eagerzeroedthick
Space required for the virtual disk is allocated at creation
time. In contrast to zeroedthick format, the data remaining on
the physical device is zeroed out during creation. It might take
much longer to create disks in this format than to create other
types of disks.

thin
Thin-provisioned virtual disk. Unlike the ´zeroedthick´ or
´eagerzeroedthick´ format, space required for the virtual disk is
not allocated during creation, but, it is allocated on demand during
first write issued to the block. Virtual disk size is zero at
creation time. This format provides more efficient user of storage
space and enables thin provisioning of virtual disks. This format is
recommended when space utilization is the main concern, and for all
types of applications except clustering.

rdm
Virtual compatibility mode raw disk mapping.

rdmp
Physical compatibility mode (pass-through) raw disk mapping.

2gbsparse
A sparse disk with 2GB maximum extent size. You can use disks in
this format with other VMware products. However, you cannot power
on a sparse disk on an ESX/ESXi host unless you first re-import the
disk in a compatible format, such as zeroedthick or eagerzeroedthick
or thin, with vmkfstools.

monosparse
A monolithic sparse disk. You can use disks in this format
with other VMware products.

monoflat
A monolithic flat disk. You can use disks in this format with other
VMware products.

DEVICE OPTIONS
-L, --lock [reserve|release|lunreset|targetreset|busreset] /vmfs/devices/disks/
Manage SCSI reservations on physical targets or LUNs. These
commands can interrupt the operations of other servers on a storage
area network (SAN), so they should be used with great caution. The
reserve command will reserve the specified raw disk.
After the reservation, other servers will get a SCSI reservation
conflict if they attempt to access that disk, but the server that did
the reservation will be able to access the disk normally. The
release command will release the reservation on the specified
disk. Other servers will be able to access the disk again. The
lunreset command resets a single LUN only instead of all
the LUNs attached to a target. The
targetreset and busreset
command will reset target and bus respectively causing SCSI
reservations to be dropped.

Caution: This option is potentially disruptive to
all servers sharing the storage and is only meant to be used for
clustering configurations.

-B, --breaklock /vmfs/devices/disks/vml.:partition
This command is used to forcibly break the LVM device lock on a
particular partition, in the event that a host crashed in the middle
of a volume operation. When this command is issued, user must
ensure that no other host is holding the lock.

If it becomes necessary to forcibly break the LVM device lock due
to a host crash in the middle of a volume operation like grow extent,
add extent or resignature, after breaking the lock, data should be
migrated off the volume and the volume reformatted.

EXAMPLES
vmkfstools -C vmfs3 -b 1m -S myVMFS vmfs/devices/disks/vml.:1
Creates a new VMFS-3 file system with label
myVMFS on the 1st
partition of the vml. device. The file block size is 1MB.

vmkfstools -Z vmfs/devices/disks/vml.:1 vmfs/devices/disks/vml.:1
Span the file system across two partitions, vml.:1 and
vml.:1. Here, vml:1 is the name of the head
partition of the file system that is to be extended.

vmkfstools -c 2048m -a lsilogic /vmfs/volumes/myVMFS/myOS/myOS.vmdk
Creates a 2GB VMFS virtual disk with the name
myOS.vmdk on the
VMFS file system named
myVMFS under the directory ´myOS´.
This virtual disk may then be accessed by a virtual machine.
The default adapter will be buslogic if the ´-a ´
is not specified.

vmkfstools -E /vmfs/volumes/myVMFS/myOS/myOS-old.vmdk /vmfs/volumes/myVMFS/myOS/myOS-new.vmdk
Rename virtual disk ´myOS-old.vmdk´ to ´myOS-new.vmdk´

vmkfstools -U /vmfs/volumes/myVMFS/myOS/myOS.vmdk
Delete virtual disk ´myOS.vmdk´.

vmkfstools -Ph /vmfs/volumes/myVMFS
List the attributes of the file system ´myVMFS´ in human-readable
form including, version number, number of partitions, label, UUID,
available space, and a listing of the device names.

vmkfstools -i /vmfs/volumes/templates/gold-master.vmdk /vmfs/volumes/myVMFS/myOS.vmdk
Clones the contents of a gold master virtual disk image from a
template repository to a virtual disk named
myOS.vmdk. The
virtual disk will be created in zeroedthick format on the VMFS
file system called ´myVMFS´ under the directory ´myOS´.
A virtual machine can be configured to use this virtual disk by
adding the following lines to its configuration file:
scsi0:0.present = TRUE
scsi0:0.fileName = /vmfs/volumes/myVMFS/myOS/myOS.vmdk

vmkfstools -i /vmfs/volumes/templates/gold-master.vmdk -d thin /vmfs/volumes/myVMFS/myOS-thin/myOS-thin.vmdk
Clones the contents of a gold master virtual disk image from a
template repository to a ´thin´ virtual disk named
myOS-thin.vmdk
on the VMFS file system called ´myVMFS´ under the directory
´myOS-thin´ and can be used in a virtual machine in the same
manner as in the previous example.

vmkfstools -i /vmfs/volume/templates/gold-master.vmdk -d eagerzeroedthick /vmfs/volumes/myVMFS/myOS-eager/myOS-eager.vmdk
Clones the contents of a gold master virtual disk image from a
template repository to a âeagerzeroedthick´ virtual disk named
myOS-eager.vmdk on the VMFS file system called ´myVMFS´ under
the directory ´myOS-eager´ and can be used in a virtual machine
in the same manner as in the previous example.

vmkfstools -i /vmfs/volumes/templates/gold-master.vmdk -d rdm:/vmfs/devices/disks/vml.:0 /vmfs/volumes/myVMFS/myOS-rdm/myOS-rdm.vmdk
Clones the contents of a gold master virtual disk image from a
template repository to a RDM
myOS-rdm.vmdk. The virtual disk
will be created in virtual mode(NonPassThru RDM) on the VMFS
file system called ´myVMFS´ under the directory ´myOS-rdm´ and
can be used in a virtual machine in the same manner as in the
previous example.

manner as in the previous example.

vmkfstools -i /vmfs/volume/templates/gold-master.vmdk -d eagerzeroedthick /vmfs/volumes/myVMFS/myOS-eager/myOS-eager.vmdk
Clones the contents of a gold master virtual disk image from a
template repository to a âeagerzeroedthick´ virtual disk named
myOS-eager.vmdk on the VMFS file system called ´myVMFS´ under
the directory ´myOS-eager´ and can be used in a virtual machine
in the same manner as in the previous example.

vmkfstools -i /vmfs/volumes/templates/gold-master.vmdk -d rdm:/vmfs/devices/disks/vml.:0 /vmfs/volumes/myVMFS/myOS-rdm/myOS-rdm.vmdk
Clones the contents of a gold master virtual disk image from a
template repository to a RDM
myOS-rdm.vmdk. The virtual disk
will be created in virtual mode(NonPassThru RDM) on the VMFS
file system called ´myVMFS´ under the directory ´myOS-rdm´ and
can be used in a virtual machine in the same manner as in the
previous example.

vmkfstools -r /vmfs/devices/disks/vml.:0 myOS-rdm.vmdk
Creates a NonPassThru RDM (virtual mode) mapping file,
myOS-rdm.vmdk to vml.:0. The mapping file
myOS-rdm.vmdk is created in the current VMFS working directory
and can be used in a virtual machine in the same manner as in the
previous example.

vmkfstools -z /vmfs/devices/disks/vml.:0 myOS-rdmp.vmdk
Creates a PassThru RDM (physical mode) mapping file,
myOS-rdmp.vmdk to vml.:0. The mapping file
myOS-rdmp.vmdk` is created in the current VMFS working directory,
and can be used in a virtual machine in the same manner as in the
previous example.

vmkfstools -k myDisk.vmdk
Convert a virtual disk in zereodthick format, ´myDisk.vmdk´ to
a eagerzeroedthick virtual disk.

vmkfstools -j myDisk.vmdk
Convert a virtual disk in thin format, ´myDisk.vmdk´ to
a eagerzeroedthick virtual disk.

vmkfstools -B /vmfs/devices/disks/vml.:partition
Break a LVM device lock on /vmfs/devices/disks/vml.:partition

VMnix September 1, 2009 VMnix

0 thoughts on “vmkfstools Manual

  1. Pingback: Myee Documentation » Clone Image on ESXi 4 with command

  2. Pingback: Gregory Smith

Leave a Reply