VMware vSphere

 View Only
Expand all | Collapse all

How to zero out free space in VMFS?

  • 1.  How to zero out free space in VMFS?

    Posted Aug 26, 2010 02:26 AM

    We are using Datacore SANmelody (software SAN) thin provisioning where it is suppose to save storage, but it end up takes up even more storage than what we actually used because partitions we deleted in ESXi do not get free up back into the storage for other use. In order to reclaim these locked up unused storage, we have to zero out the empty blocks.

    Is there any tool to do this on VMFS drives? The solution I found here doesn't look safe: http://communities.vmware.com/thread/188141



  • 2.  RE: How to zero out free space in VMFS?

    Posted Aug 26, 2010 07:21 AM

    This is the right solution.

    Instead of cat you can use the dd command (available also on ESXi):

    dd if=/dev/zero of=zero.bin bs=1M

    Run this command in the right VMFS folder.

    Andre



  • 3.  RE: How to zero out free space in VMFS?

    Posted Aug 26, 2010 07:38 AM

    Thanks Andre. Do I have to shutdown all VMs running in this VMFS before running this?



  • 4.  RE: How to zero out free space in VMFS?

    Posted Aug 26, 2010 07:42 AM

    Usually no... It simple create a dummy file (that you have to remove after the creation) in the free space.

    But if you have VMs with thin disks or active snapshot this can create an issue... because no free space will be available (untill you do not delete the file).

    Andre



  • 5.  RE: How to zero out free space in VMFS?

    Posted Aug 26, 2010 08:24 AM

    Instead of cat you can use the dd command (available also on ESXi):

    How do you run it on ESXi? From a vMA or Technical Support Mode?



  • 6.  RE: How to zero out free space in VMFS?

    Posted Aug 26, 2010 08:30 AM

    You need a console to use dd command.

    So from Technical Support Mode.

    I do not know if there is something similar for vMA.

    Andre



  • 7.  RE: How to zero out free space in VMFS?

    Posted Aug 26, 2010 08:36 AM

    Ok. Will the command fill up all available space in the datastore?

    dd if=/dev/zero of=zero.bin bs=1M

    Could you enter a filesize if wanted?



  • 8.  RE: How to zero out free space in VMFS?

    Posted Aug 26, 2010 08:41 AM

    This command stops with an error when no space is available.

    To enter a size you can use the count=#blocks option.

    Andre



  • 9.  RE: How to zero out free space in VMFS?

    Posted Aug 26, 2010 08:51 AM

    Thanks, and the size of the blocks is the parameter bs? Should this correlate to the VMFS block size by the way?



  • 10.  RE: How to zero out free space in VMFS?

    Posted Aug 26, 2010 09:18 AM

    AndreTheGiant already mentioned the command to create a "zero" file and the risk of filling up the datastore. Therefore the "rm" command should be added directly to the command.

    see http://communities.vmware.com/message/1596020#1596020

    1. dd if=/dev/zero of=xxx.zero bs=X count=Y ; rm xxx.zero

    André



  • 11.  RE: How to zero out free space in VMFS?

    Posted Aug 27, 2010 06:56 AM

    Datacore SANmelody suggested this instead:

    To create and zero out in one sweep, type the

    following at the command line:

    *vmkfstools -c <size> -d

    eagerzeroedthick /vmfs/volumes/<mydir>/<myDisk>.vmdk

    *

    To zero out an existing disk, type the following at

    the command line:

    *vmkfstools -w

    /vmfs/volumes/<mydir>/<myDisk>.vmdk*