I have some windows and linux based guest vms with thin provisioning. i deleted data from these guest vms which is approx 200 GB but the datastore shows me only 30 GB space where as these VMs are using only 10 to 20 GB space. Please tell me any solution to reclaim the unused space in ESXi 5.5. My datastore does not support HW Acceleration.
Have you tried to svmotion each vm? During wizard the system ask for a VM format: choosing thin I thin provisioning svmotion will reclaim effective utilized space from VM... (only if you have licensed node with enterprise edition)
I am not using vmotion or svmotion. then how can i reclaim..?
Are you connected to a vcenter or is your node licensed free? If you have a minimum paid licence like essential, you could try to cold migrate change datastore (Power off vm, migrate datastore, choose thin prov, Power on vm).
Otherwise I think there are no solutions.
I am using vCenter server 5 standard edition license. please let me know if it is possible in this edition and how..?
Then try to cold migrate change datastore:
1.Power off vm
2. migrate datastore
3. choose thin prov
4. After migration complete, power on vm
I think you should move VM between 2 datastore to reclaim your space (shared to local, then local to shared again)
Please let me know if it goes well.
Ok i will try this way on a test vm as i can not power off my production VMs. is there anyway withour powering off the VMs..?
i have previously tried create the vm into ovf template and then downloaded to the laptop and then uploaded again to the local datastore with thin provisioning but it doesn't work.
There are a few approaches,
one is the mentioned svmotion to another datastore. If you don´t have another datastore you could use for windows the sysinternals sdelete tool
sdelete.exe -z [DRIVE:]
is the command inside the guest. Please be aware that this will expand your disk to the maximum size.
for linux you could use something like this:
dd if=/dev/zero of=/[mounted-volume]/zeroes && rm -f /[mounted-volume]/zeroes
where [mounted-volume] is where you mounted the volume.
After that power off the VM and log in to you your esx. The command
vmkfstools -K [disk].vmdk
where [disk].vmdk is the corresponding disk file of the vm, will shrink the disk.
AFAIK there is no way to do this while the VM is powered on.
Please keep in mind that if the LUN of the datastore is also thin provisioned there is more work to do to free the blocks physically. The following command will do that if your storage system supports vaai scsi unmap:
esxcli storage vmfs unmap -l MyDatastore
I would highly recommend checking out the following KB:
VMware KB: Using esxcli in vSphere 5.5 to reclaim VMFS deleted blocks on thin-provisioned LUNs
I perform sdelete in windows as you mentioned but it fill the datastore space to maximum and i start receiving alerts of low storage on datastore. when only 13Mb remaining the VM stop responding and i am unable to access the VM guest. please let me know what further actions should i take to solve the issue as now i am unable to access the VM or even i am unable to powered on the VM
As i wrote above, sdelete will temporary grow the size of the disk to it´s maximum because it is filling unused space with zeros. So you need temporary space.
In this case, as indicated by Wscholz try the comand:
vmkfstools -K [disk].vmdk
As indicated here: vSphere 5.5 Documentation Center this comand deallocates 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.
my disk mount point is /dev/sda5. but i am unable to process this command in linux. please send me an example if i am missing something.
dd if=/dev/zero of=/dev/sda5 bs=4096 && rm -f /dev/sda5
please tel me the correct syntax of this command as i am unable to process this command.
Please look at the syntax above. You do not specify the disk device like /dev/sdaXX, you specify the mountpoint and a temporary file. So if you want to zero out /dev/sda5 and /dev/sda5 is mounted as /var then you have to type
dd if=/dev/zero of=/var/mytempfile
After the command errors out you type
rm -f /var/mytempfile
to delete the tempfile
can you briefly explain me how can i use this command. i am explaining you in my scenario.
I copied a 2.2 GB file at this location.
now i run this command to remove the above cbt file so that we can reclaim the deleted unused space
rm -rf /root/cbt
and then i run this command to reclaim the space as you mentioned.
dd if=/dev/zero of=/root/cbt && rm -rf /root/cbt
the result is it created the deleted cbt file to the same location but increase it's size and then gives error no space left. where as it a new test vm and it has 43GB free space and i copied only 2.2 GB file in /root
and it shows me total space 7.5 approx before running all this. i have attached the screen shot
after running the dd command it created 40G file
the process is
dd if=/dev/zero of=/cbt
after the command errors out run
rm -rf /cbt
After that, shutdown the VM, login to ESXi Console and run
vmkfstools -K [disk].vmdk
Where [disk].vmdk is the diskfile of your virtual machine where the / partition resides.
can you help me how regarding linux guest OS to reclaim space as i am unable to reclaim. if you can give me an example how to reclaim I shall be very thankful to you.
the examples are in the posts above. if you get errors pls describe what you mean with "i am unable to reclaim".
Thanks for your help. this solution works fine when i have single partition like /root but when i have multiple partitions like /root, /data, /var, /recording then i am unable to reclaim unused space from these partitions. In fact it increased the size rather than decreasing. please tell me how can i reclaim with different partitions. i used this format
dd if=/dev/zero of=/root/temp-file
rm /root/temp-file -f
dd if=/dev/zero of=/data/temp-file
rm /data/temp-file -f
dd if=/dev/zero of=/var/temp-file
rm /var/temp-file -f
dd if=/dev/zero of=/recording/temp-file
rm /recording/temp-file -f
when i check space df -h it shows me total 24GB and when i run vmkfstool command after dd and deleting temp-files it increased size to 142GB. please let me know if there is any issue in my commands.