VMware Cloud Community
edwinlcf
Contributor
Contributor
Jump to solution

Reclaim the space of datastore

Hi,

Can the vSphere 6.5 support the auto reclaimed space of datastore? e.g. If I write and delete the 100GB files on one of VM, the datastore can reclaim the space of datastore?

Can the vSphere 5.5 / 6 support the manual reclaim space? Where to run the reclaiming function through GUI? Need command base to do that?

1 Solution
6 Replies
edwinlcf
Contributor
Contributor
Jump to solution

Can work the reclaiming function manually on ESXi 5 through GUI?

0 Kudos
edwinlcf
Contributor
Contributor
Jump to solution

If I deleted 100-GB files of a VM (thin-provision), I must type the command to reclaim VMFS deleted blocks on thin-provisioned LUNs on ESXi version 5.5, right?

0 Kudos
MDNaseer
Enthusiast
Enthusiast
Jump to solution

Hi,

If you are not comfortable with command line, use svmotion if the vmdk sizes are not huge.

0 Kudos
sjesse
Leadership
Leadership
Jump to solution

That doesn't work past 5.0, svmotion doesn't trigger the unmap command till you get to 6.5. I'm pretty sure you need to run the command line command from 5.1-6.0, 6.5 will remove a little at a time from my understanding.

JosephPJ
Contributor
Contributor
Jump to solution

You can use below commands  to reclaim space (issue the command from the esxi host where your VM server residing ;

On CentOS server;

dd if=/dev/zero of=/home/zeroes bs=4096 && rm -f /home/zeroes

on Windows Server;

vmkfstools -K YourVMwarename.vmdk

(Where vmkfstools supports the -K option (--punchzero), you can reclaim the zeroed blocks of thin-provisioned virtual disks without the need to clone to another VMFS datastore with a different block size.

  1. Ensure that the disk has no Snapshots.
  2. In a Windows virtual machine, run the SDelete command (or a tool with similar functionality) to zero out all unused space. The syntax for the SDelete command is SDelete -z driveletter. If you use SDelete, ensure that you use version 1.6 or later.

    Note: Zeroing all unused blocks inflates the disk to its full size and converts it into an eagerzeroed disk. If the original disk is a thin provisioned disk, ensure that there is sufficient space on the datastore to allow the disk to grow to its full size.
  3. Shut down the virtual machine or temporarily remove the virtual disk from the virtual machine to ensure that it is not in use.
  4. Erase all unused blocks by running the command:

    vmkfstools -K /path/to/disk-name.vmdk


    Note: The punchzero (vmkfstools -K) command is not compatible with NFS based VMFS datastores.

    This option de-allocates all zeroed out blocks and leaves only those blocks that were allocated previously and contain valid data. The resulting virtual disk is in thin format.)
0 Kudos