Our customer has VM with CentOS on ESXi host. I have to shrink the disk size of the VM and need to reclaim that free disk space back to ESXi host. Disk type on VM is Thick provisioned.
How to do it?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
1) In vcenter record current data store 2) on linux server - dd if=/dev/zero of=//0file bs=20971520; rm -f //0file 3) In vcenter - migrate to another data store as Thin Provision (migrate option and check change storage only, then click on advanced button when selecting storage and using pull down that initially says to keep formate - change to thin provisioning) 4) in vcenter - migrate back to original data store from step 1 5) On linux server set up a crontab entry to do fstrim for filesystem (on some systems can set an option in fstab to do fstrim immediately, but I've seen posts that say it can hurt performance).