Reclaiming disk space from thin provisioned VMDK files on ESXi (2136514)
Reclaiming disk space from thin provisioned VMDK files on ESXi (2136514)
https://kb.vmware.com/s/article/2136514
Symptoms
Virtual Machines (VM) using thin provisioned disk do not see size decrease after deleting files from the Guest Operating System.
Purpose
This article provides steps to manually reclaim unused disk space by the Guest OS to shrink the thin provisioned disk. For more information, see Storage Space Reclamation.
Cause
Deleting data from Guest OS only removes the data from the file allocation table but does not zero the blocks. As a result, the ESXi Host still sees the blocks in use even after deleting the data.
Resolution
Reclaiming disk space is a two steps process
The first step is to delete the blocks on the Guest Operating System then reclaim space on the VMFS datastore. Be sure to follow the bellow steps in order.Step 1: Delete the blocks on the Guest OS
Windows Operating System
- Download SDelete Command Line Tool available at https://docs.microsoft.com/en-us/sysinternals/downloads/sdelete
- Open an elevated command prompt.
- Run this command
Linux Operating Systems:
Linux has different ways to delete the unused blocks, the most common method is to fill the free space with a file of zeroes using the dd command:
$ dd if=/dev/zero of=/mounted-volume/zeroes && rm -f /mounted-volume/zeroes
Notes:
- Be sure to shutdown all services which writes to the target volume to avoid running out of space
- If there are multiple partitions on a single virtual disk, same step needs to be performed on all partitions. Otherwise the reclamation will be partial because not every data block will be zeroed.
Step 2: Reclaim space on VMFS
- Power off the virtual machine.
- Log in to the ESXi host using SSH and root credentials.
- Navigate to the directory that contains the virtual machine disk using the command:
- Run this command:
Notes:
- The file used here is descriptor file .vmdk file not the data file -flat.vmdk
- The process may take longer depending on the size of the disk and number of blocks.
Comments
Post a Comment