Home » Tech » Reduce the size of the VMware Virtual Machine Disk (VMDK): Detailed Information

Reduce the size of the VMware Virtual Machine Disk (VMDK): Detailed Information

author
Published By Siddharth
Aswin Vijayan
Approved By Aswin Vijayan
Published On January 23rd, 2024
Reading Time 5 Minutes Reading

VMDK, which stands for Virtual Machine Disk, is one file format, which is used to describe the containers for virtual hard disk drives. This is used in virtual machines like VMware Workstation or VirtualBox. VMware develops it for its virtual appliance products. Quite often users want to know that how to reduce virtual machine disk size. One of the major reasons to shrink VMDK size is that it can show or reflect the actual usage of the virtual machine. In addition, the size of the virtual machine is lessened to make some free space as the machine takes so much space and can be problematic sometimes. Therefore, in the below section of this blog, we will discuss the methods to shrink the vmdk size, is not so complex way.

Recommended Solution- Use VMvare Recovery Tool in order to repair & recover VMware Virtual Machine Data from Corrupt VMDK files.
Download

How to Reduce a VMware Virtual Machine Disk Size

There are two manual methods to shrink virtual machine size which are mentioned below:
Method 1
Users who want to reduce VMDK size need to follow these steps:

  • Firstly, select the Virtual Machine, then select Edit Settings, and highlight the Virtual Hard Disk
  • Now, select Edit – there is an option to change the size.

By this, users can only modify the physical size of the virtual disk. This method cannot grow the division on the disk. In case of unavailability of this option, users may have an IDE disk that does not support expansion, or users may have a snapshot, which is attached to the virtual disk.

Note: Make sure you have a full backup before any disk partition or expansion.

Method 2
To shrink VMDK disk size the method mentioned below will help you to follow two steps for the accomplishment of the task:
Step 1: Reduce the size of Operating System partition
Step 2: Shrink the VMware Virtual Machine Disk (VMDK)

Therefore, to reduce the size of VMDK, users need to lessen Operating system size, with these users can avoid corruption in the system file.
In the following section, we will discuss how this task can be done in Windows 2008 R2. This operating system has a shrink function.

Step 1: Shrink the Size of Operating System

  • With the connection of Remote Desktop Protocol (RDP) or connection with the Console, using the vSphere Client, you need to login to the virtual machine as an Administrator.
  • Now, press Control-Alt-Delete, by this you can log in to the virtual machine.

5

  • Once you have done that, make a right Click on My Computer and choose Manage
  • Then, select Disk Management, and choose the partition you need to shrink

6

  • Make a right click on the Volume/Partition to shrink, and click on Shrink
  • A dialogue will appear as “Querying volume for available shrink space. Please wait.”
  • Now again, the dialogue will appear. You need to enter a size to shrink the OS partition.

The size we are taking of VMware virtual machine disk (VMDK), in this example, is 50GB, and we will shrink the size to 25 GB. The Disk Management utility scans all the file system, that is available and reports a maximum size the OS partition that can be reduced, this is based on current file system usage.

Now, enter the figure 24.5 (GB) x 1024 = 25,088
Operating system partition size after, shrink operation.
Now an unallocated 24.5GB space is available on the virtual disk. In Step 2, removing this unallocated storage space, the virtual machine disk (VMDK) will be “chopped”. With this finally, the VMDK size will reduce to 20GB. We do not affect the existing partitions. Therefore, this operation is safe and secure.

Step 2: Reduce Virtual Machine Size(VMDK)

  • Firstly, you need to log in and connect to the VMware vSphere Host ESXi server, which hosts the virtual machine.
  • Then, power OFF the Virtual Machine, to change to the data store path where the VMware virtual machine disk (VMDK) is located.

cd /vmfs/volumes/<datastore name>/<VM foldername>

Now, change the *.vmdk. It is the descriptor file and has the variables for the size of the *.-flat.vmdk. with the help of a cat. These are some things, which is a descriptor file contains:

  • The number highlighted above, under the heading #Extent explanation
  • After the letters, RW shows the VMware virtual disk (VMDK) size.

This value- 104,857,600 and it’s calculated as follows:

50 GB = 40 * 1024 * 1024 * 1024 / 512  =  104,857,600

We wanted to reduce the size of the VMware virtual machine disk (VMDK) from 50 GB to 25GB. Therefore, the value we need to enter into the descriptor file is-

25 GB = 20 * 1024 * 1024 * 1024 / 512 = 52,428,800
Now, you need to change the value of descriptor file with the help of vi and change the number from 104,857,600 to 52,428,800. Once you have done that click on the option of saving. With this, the process to reduce virtual machine size will be finished.

Conclusion

There are so many organizations or users who use a virtual machine for professional reasons. In the above blog, we have learned that at times the need to shrink the size of virtual machine arises in front of the users. Therefore, for the accomplishment of the task, users can opt for any of the methods to shrink the size of the virtual machine as given above. Sometimes, users find manual methods to reduce the size of VMware tough and complex, so they can take the help of third-party utilities.