Shrink A Vmware Virtual Machine Disk (VMDK)

 In This Post We will figure out how to do it without VMware converter as when utilizing VMware converter, you will burn-through a ton of time.

Prior to your beginning the accompanying methodology, kindly guarantee you have a valid and tested Full Backup of your virtual machine. This doesn't mean a VMware Snapshot.

Truth be told, expanding the size of a VMware Virtual Machine Disk (VMDK) is direct, and is supported in the vSphere Client, by choosing the virtual hard disk, and expanding the size utilizing the up bolt or then again composing in another value.


Notwithstanding, despite the fact that there is a down bolt present, you can't shrink the disk along these lines, it's not supported. The main supported strategy for contracting a VMware virtual machine disk (VMDK) is to utilize VMware vCenter Converter Standalone and make a virtual to virtual (V2V) conversion, a comparative process to a Physical to Virtual (P2V) conversion.

You can review this VMware KB :

https://kb.vmware.com/s/article/1002019

 V2V Disadvantages

  • V2V Conversions can be slow.
  • You want to guarantee, you have enough datastore storage space for the new virtual machine disk.
  • The virtual machine is converted, so there is a little danger, the conversion can cause issues with the converted virtual machine.
  • The converted machine can contain an alternate MAC address.
  • V2V are inclined to disappointment.


V2V Advantages

  • Support end-client strategy for re-estimating a virtual machine disk.
  • GUI Interface when utilizing VMware vCenter Converter Standalone

In the wake of perusing and understanding this article, you will actually want to decrease the size of virtual machine disks in under five minutes. I will allow the peruser to choose if this is a quicker technique than the conventional act of utilizing a V2V, to change the size of a VMware Virtual Machine Disk (VMDK). Every so often we go over an establishment, where an Administrator has appointed a 2TB virtual disk, and doesn't have the space to make a V2V!

The accompanying strategy is parted into two sections

  • Shrink the Operating System partition – This is canvassed in Step 1.
  • Shrink the VMware Virtual Machine Disk (VMDK)  – This is shrouded in Step 2

LOGIN TO THE VIRTUAL MACHINE AND SHRINK THE OS PARTITION

Before we can shrink the VMware virtual machine disk (VMDK), we want to shrink the OS partition. (to keep away from file system corruption). In this model I am utilizing Windows 2008 R2, which has a shrink function.

Utilizing a RDP (Remote Desktop Protocol) association or interface by means of the Console, utilizing the vSphere Client, login to the virtual machine as an Administrator. Go to Disk Management, and select the partition you really want to shrink. Right Click the Volume/Partition to shrink, and select Shrink.



the above discourse will show up. Enter a size to lessen the OS partition.

In this model the VMware virtual machine disk (VMDK) is 40GB, and we might want to decrease the size of the VMware virtual machine disk (VMDK) to 20GB. The Disk Management utility outputs the accessible file system, and reports a greatest size the OS partition can be lessen by, this depends on current file system use.

Enter the figure 19.5 (GB) x 1024 = 19968


OS Partition size after Shrink Operation.


As can be obviously found in the above screen capture, there is currently an unallocated 19.5GB space on the virtual disk, in Step 2 the VMware virtual machine disk (VMDK) will be "cleaved", eliminating this unallocated extra space, lastly diminishing the virtual machine disk (VMDK) to 20GB. Giving that we DO NOT influence the current partitions, this is a protected activity. So basically the "cut" will be made in the unallocated extra space, after the OS partition.

Diminishing The Size Of The Vmware Virtual Machine Disk (Vmdk)

Login and associate with the VMware vSphere Host ESXi server which has the virtual machine.
Power OFF the Virtual Machine, and change to the datastore location where the VMware virtual machine disk (VMDK) is found.

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


We want to alter the *.vmdk, which is the descriptor file, which contains the factors for the size of the *.- flat.vmdk. Utilizing cat, this is the thing that the descriptor file contains

The number featured above, under the heading #Extent description, after the letters RW, characterizes the size of the VMware virtual disk (VMDK).
his number – 83886080, and it’s calculated as follows:
40 GB = 40 * 1024 * 1024 * 1024 / 512  =  83886080

We needed to diminish the size of the VMware virtual machine disk (VMDK) from 40 GB to 20 GB. So the worth we want to go into the descriptor record 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.


Move or Copy the virtual machine to another datastore.

After the virtual machine disk (VMDK) has been moved, you will see the disk size mirrors the ideal size of 20GB.


In the wake of restarting the virtual machine, and checking with Disk Management, you will see the 19.5GB unallocated space, has been eliminated, and vanished.


No comments

Powered by Blogger.