Showing posts with label Virtual Disk. Show all posts
Showing posts with label Virtual Disk. Show all posts

Sunday, October 4, 2009

VMware - Convert between growable and preallocated (*.vmdk)

A VMDK file can be converted into another formate while no VM is using it. The operation will copy the old disk into a new one.

vmware-vdiskmanager -r <source-disk> -t <type> <target-disk>

Disk type can be one of:

0                 : single growable virtual disk
1                 : growable virtual disk split in 2Gb files
2                 : preallocated virtual disk
3                 : preallocated virtual disk split in 2Gb files

VMware - Grow an existing virtual disk (*.vmdk)

A VMDK file can be grown while no virtual machine is using it. Growng the VMDK only makes the virtual harddrive bigger - filesystem within the VMDK must still be grown with other methods (for instance on Windows, diskpart).

On ESX:
vmkfstools -X <newsize>G filename.vmdk

On ESX 3.5, you can also edit the VM settings and edit the harddrive when the VM is not running.

Note that on ESX the filename.vmdk file is just a  file containing metainformation and "filename-flat.vmdk" is the actual data file. However, vmkfstools operations are used on the metafile

On VMware Server Workstation and VMware Fusion:

vmware-vdiskmanager -x Gb filename.vmdk

For instance, if growing an existing vmdk file named "server1.vmdk" and it is to be grown so it's new size is 20GB, the command would be:

On ESX:

vmkfstools -X 20GB server1.vmdk

On Server/Workstation/Fusion

vmware-vdiskmanager -x 20Gb server1.vmdk

On Fusion vmware-vdiskmanager is located by default at /Library/Application Support/VMware Fusion/vmware-vdiskmanager