Macro 32 Ramblings

Mind Archive

VMWARE – vmkfstools – Disk Resizing

vmkfstools VM-Disk and VMFS Management in the console

 

vmkfstools  -X

Extend virtual Disk

vmkfstools  -X  12G ./testing.vmdk

To extend an existing Virtual Disk to 12GB. Instead of G you can use M for Megabytes
With the same command you can shrink the disk (only for ESX Version prior to 3.0)  if you choose a smaller than the present size. Be aware if the shrinked size is smaller as the partition size in the guest there might be a data losse or a corrupted system resulting!


In some cases the shrink command must be issued with the –force option:

vmkfstools -X  4G ./testing.vmdk –force

For shrinking on ESX 3.0x  use the VMWare Converter (download from the VMware Website for freee).  Point the source and destination to the same ESX Host. 

If you receive an error one parameter was incrorrect the size might be smaller as the original size!

If you have blanks in the file or directoryname, mask the full path with  ‘

vmkfstools  -i

 

To export or clone a virtual disk from VMFS
vmkfstools -i  <source-file> -d diskformat <destination-file>

Example:

Copy from one vmfs to another:

Source=/vmfs/volumes/esxpublic/testvm2.vmdk
Destination=/vmfs/volumes/production/testvmnew2.vmdk

vmkfstools -i /vmfs/volumes/esxpublic/testvm2.vmdk /vmfs/volumes/production/testvmnew2.vmdk

Export to ext3 partition:

Source=/vmfs/volumes/esxpublic/testvm2.vmdk
Destination=/vmimages/testvm2.vmdk

vmkfstools -i  /vmfs/esxpublic/testvm2.vmdk -d 2gbsparse /vmimages/testvm2.vmdk

 

vmkfstools  -E

Rename files associated with a specified virtual disk

 

vmkfstools  -U

Delete Virtualdisk
Delete files associated with the specified virtual disk.

 

vmkfstools  -c 4000M ./file.vmdk

To create a new empty virtual disk

vmkfstools -c 300G -a lsilogic /vmfs/volume/vmfslabel/directory/newdisk.vmdk

or in current directory

vmkfstools -c 300G -a lsilogic ./newdisk.vmdk

This command is very useful because you can use user-friendly names for the disks

 

 

 

For further options enter man vmkfstools