Need help?

Our experts have had an average response time of 11.7 minutes in August 2021 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

Shrink VMDK Virtual Disk Size on VMWare ESXi – How to do it

by | Apr 22, 2021

Unlike expanding a disk of a VMWare virtual machine, it is more complicated to shrink VMDK Virtual Disk Size on the VMWare ESXi hypervisor.

It is impossible to do it via the vSphere Web Client graphical interface. It does not allow to specify a smaller virtual disk size.

As part of our Server Management Services, we assist our customers with several VMWare queries.

Today, let us see how to reduce the size of a virtual disk (vmdk) file of the virtual machine running on VMWare ESXi.

 

Shrink VMDK Virtual Disk Size on VMWare ESXi

Before we reduce the size, we need to do the following on the VMWare ESXi host:

  1. Delete all snapshots of the virtual machine not to damage the virtual disk
  2. Create a full backup of the virtual machine or a copy of the vmdk and flat files we want to shrink.
    cp vmname.vmdk backup_vmname.vmdk
    cp vmname-flat.vmdk backup_vmname-flat.vmdk

Shrink VMDK Virtual Disk Size on VMWare ESXi

The process to reduce a virtual disk size consists of two steps:

  1. Shrink the partition inside the guest OS
  2. Reduce the size of the VMDK file of the VMWare virtual machine on the VMFS (NFS) datastore.

 

How to Shrink the Partition Size in the Guest OS?

Initially, we need to reduce the size of the disk partition in the guest operating system.

If the virtual machine runs Windows OS, we use the Disk Manager diskmgmt.msc or third-party tools. Failure of which may lead to a file system crash.

For instance, if we want to reduce the disk size by 40 GB, the volume size must reduce by 40960 MB (40 GB x 1024). We enter this value in the corresponding field of the Shrink Volume wizard. Once done, there will be some unallocated space to the right of our partition.

 

Reduce the VMDK File Size of the VMWare Virtual Machine

In order to reduce the size of the VMDK file on the VMWare VMFS file system, our Support Techs suggests the following steps:

  1. Initially, we shut down the virtual machine we want to reduce disk size.
  2. Via SSH, we connect to the console of the ESXi host the VM is registered on
  3. Then we go to the directory the VMDK file of our VM is located in:
    cd /vmfs/volumes/datastore/test-VM
  4. We display the contents of the virtual disk configuration file (*.vmdk) using the cat command:
    # cat test_vm_3.vmdk
  5. The size of the vmdk disk is shown in the #Extent description section.
  6. To reduce the VMDK disk from 80 to 40 GB, we have to specify 83886080 in the Extent description section. Set the new size of the virtual disk using a text editor.
    For example,

    # vi test_vm_3.vmdk
  7. From the down arrow key, go to the line containing the disk size. Specify the new size, save the changes and close the file.
  8. Then we clone or migrate the virtual machine to another datastore. Once we move the virtual machine files, the new size of its virtual disk will display in its properties.
  9. Ensure the new size displays in the VM properties.
  10. Then start the VM, log in to the guest OS, and make sure that the unallocated area has disappeared and the disk size has been reduced.

 

Shrink a VMDK Using VMware vCenter Converter Standalone

GUI tool VMware vCenter Converter Standalone is another way to reduce a virtual disk size of a VMWare virtual machine.

Pros:

  • V2V conversion is slow
  • Need enough space on the datastore to save the new VM
  • The new virtual machine will have a new MAC address.

Cons:

  • We do not need to open the vCenter or ESXi host console
  • Creates an exact copy of a VM
  • The source disk cannot be damaged in case of any errors in conversion task settings.

Instead of Suspend, we have to Shut down the virtual machine we want to change the disk size.

  1. Initially, we specify the ESXi host address and select the source VM.
  2. Then we set the parameters of the new VM.
  3. Go to the disk edit mode (Data to copy -> Edit).
  4. Select the copy mode: Select volumes to copy.
  5. We specify the new disk size for the new VM.
  6. Once we run the VM conversion process, we can power off the source VM and power on the new one.
  7. Ensure the disk size has been reduced. After that, we can remove the original VM.

[Need help to shrink the size? We’d be happy to assist]

 

Conclusion

In short, we saw how our Support Techs shrink VMDK Virtual Disk Size on VMWare ESXi.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF