Reducing the size of the VMware Virtual Machine Disk (VMDK)
Login and connect to the VMware vSphere Host ESXi server which hosts the virtual machine.
Power OFF the Virtual Machine, and change to the datastore path where the VMware virtual machine disk (VMDK) is located.
cd /vmfs/volumes/<datastore name>/<VM foldername>
We need to edit the *.vmdk, which is the descriptor file, which contains the variables for the size of the *.-flat.vmdk. Using cat, this is what the descriptor file contains
The number highlighted above, under the heading #Extent description, after the letters RW, defines the size of the VMware virtual disk (VMDK).
this number - 83886080, and it's calculated as follows:
40 GB = 40 * 1024 * 1024 * 1024 / 512 = 83886080
We wanted to reduce the size of the VMware virtual machine disk (VMDK) from 40 GB to 20 GB. So the value we need to enter into the descriptor file is:-
20 GB = 20 * 1024 * 1024 * 1024 / 512 = 41943040
Using vi, edit the descriptor file, and change the number from 83886080 to 41943040, and save the file.
Migrate or Copy the virtual machine to another datastore.
After the virtual machine disk (VMDK) has been moved, you will notice the disk size reflects the desired size of 20GB.
After restarting the virtual machine, and checking with Disk Management, you will notice the 19.5GB unallocated storage space, has been removed, and disappeared.
you have successfully Shrunk a VMware Virtual Machine Disk (VMDK)
No comments:
Post a Comment