How To Shrink VMware Virtual Disk Files (.vmdk)

Increasing the VMDK size can be done in GUI but decreasing the size of VMDK is not allowed. In most cases, For virtual machine hard disk shrink can be performed via v2v. It is the safest method to reduce the virtual machine VMDK size but there is an another simple approach which saves lot of efforts rather than performing v2v.

we can decreasing the size of VMDK using command by editing the descriptor file for the flat VMDK file  and now we can start this steps one by one to be more clarification.

1- open your vCenter server and edit your VM setting and get the name of the vmdk that you want to reduce.

1

2- the 2nd step we will use putty to connect to the ESXi via ssh.

7

3- Go to the location of the VM and write command LS to show all VM folder contain.

2

4-after that write this command cat TEST_1.vmdk this command will appear all the contains of the VMDK descriptor file

5- after that write this command vi TEST_1.vmdk this command can help us to edit the  VMDK descriptor file

here i show you the size this number 209715200+100 it’s the size of the VMDK file in this VM and you can calculate it as this way 100*1024*1024*1024=/512

3

Now we need to edit the size to 50 G  write command vi TEST_1.vmdk and press insert to edit file go to RW 209715200 and edit it to

50*1024*1024*1024=/512 it will be 104857600 you now changed the size of the disk4

But to reflect this editing you must make Storage vMotion to this virtual machine

5

or you can delete it from inventory  and add it again .

6

Congratulations, you have successfully Shrunk a VMware Virtual Machine Disk (VMDK)

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s