How to reduce the size of vmdk

The task of making a VMDK bigger is very easy; the dynamic growth of a thin-provisioned disk or the hot-add of new disks are common practice for vSphere administrators. But the ability to expand the high boundary of a VMDK is easily done through the vSphere Client. You will quickly see, however that the ability to manage the VMDK once it is made is only upward. There is no dynamic shrink of a VMDK or thin-provision reclaim of VMDKs (though some storage systems will provide that with drivers or physical-mode RDMs).
This is where VMware Converter can help out. It can take an existing VMDK and pick it up and place it on a new vSphere virtual machine (VM) with new drive geometry (smaller size). In Figure A below, I’ve selected my home file server, DROBO-FILER1, as a candidate (called a source machine) to have the 2TB drive file reduced to a smaller size:

Figure A

VMware Converter Wizard
VMware Converter Wizard
After the source virtual machine is analyzed, a destination VM is to be selected with a new name. In my case, I’m only going to preserve the file server’s data VMDK file, so this new virtual machine will only be in place temporarily. Figure B shows the destination VM being created:

Figure B


The next step is to select a destination datastore for the destination VM. In my case it is imperative to select one with enough space for this VMDK. The next step in the conversion wizard is somewhat complex. You have to click the destination layout options, and from there select the Advanced View. This is where you can select options such as to layout the disks as thin-provisioned and to resize the VMDK. This step is shown in Figure C:

Figure C


Click to enlarge images.
At this point, the wizard can launch the task in VMware Converter. Once the task is complete, the new VM can be used as-is with the VMDK having a smaller geometry, or selected VMDKs can be inventoried in the original VM. This would be for advanced users who possibly want to keep other VMDKs and the original VM’s managed object reference in vSphere.
This isn’t exactly a seamless experience, but it is possible for the occasional task where VMDKs need to shrink. There are other tasks, such as adding a new VMDK and using the guest operating system to move the (smaller) data profile to the new volume, but VMware Converter can be quicker and less error prone, especially when permissions come into play.

Comments

Popular Posts