Monday, April 1, 2013

Reclaim the space on storage from a VM

When files are deleted within the  guest VM running on a NFS storage mounted on ESXi, basically only the inode entries are updated with info that these blocks can be reused. The actual NFS storage does not free up this space.

Above blog, talks about reclaiming via vmware tools and  sdelete.

On linux, you can do this

on linux try this on user VM , to if free space is 32G, then 

df -h 

/mnt/local_disk1 has 32G free, you can zero out about 32G. 

dd if=/dev/zero of=/mnt/local_disk${i}/zero.out bs=$((4*1024*1024)) count=8000 && rm /mnt/disk1/zero.out
then delete zero.out