What are some ways to reduce the size of a virtual machine on ESXi without reducing the disk size of the host operating system (not shrink)?
There are several hypervisors ESXi 5.1, 5.5, 6.0. There are several virtual machines (VMs) that have snapshots. All of these VMs have THIN disk type. There is little disk space left on the hypervisors. What are some ways to reduce the size of a VMs without reducing the disk size of the host operating system (not shrink)?
1) The first thing that comes to mind is to delete some snapshots and this helps. But I can’t delete some pictures, because they are needed.
2) I conducted an experiment on moving (move to) a virtual machine from one hypervisor to another. With this transfer, snapshots are also transferred. I moved one VM that had one snapshot and I took measurements (it is possible that I did the wrong measurements, not 100% sure).
BEFORE:
/vmfs/volumes/50c7659e-3221b402-f0fa-0025906c0540/Automation # ls -al
drwxr-xr-x 1 root root 1820 Oct 4 11:59 .
drwxr-xr-t 1 root root 1960 Aug 30 14:06 ..
-rw------- 1 root root 4244701184 Oct 4 11:59 Automation-000001-delta.vmdk
-rw------- 1 root root 323 Aug 30 15:21 Automation-000001.vmdk
-rw------- 1 root root 28332 Aug 30 15:21 Automation-Snapshot1.vmsn
-rw------- 1 root root 32212254720 Aug 30 15:20 Automation-flat.vmdk
-rw------- 1 root root 8684 Oct 4 11:59 Automation.nvram
-rw------- 1 root root 503 Aug 30 14:25 Automation.vmdk
-rw-r--r-- 1 root root 464 Aug 30 15:21 Automation.vmsd
-rwxr-xr-x 1 root root 2815 Oct 4 11:59 Automation.vmx
-rw-r--r-- 1 root root 265 Aug 30 14:06 Automation.vmxf
-rw-r--r-- 1 root root 292954 Aug 30 15:20 vmware-1.log
-rw-r--r-- 1 root root 155428 Oct 4 11:59 vmware.log
/vmfs/volumes/50c7659e-3221b402-f0fa-0025906c0540/Automation # du
35607568
AFTER:
/vmfs/volumes/5b5756e6-af674044-1b69-ac1f6b0ded4e/Automation # ls -al
total 7547920
drwxr-xr-x 1 root root 1680 Oct 4 12:31 .
drwxr-xr-t 1 root root 9660 Oct 4 12:26 ..
-rw------- 1 root root 4244701184 Oct 4 12:31 Automation-000001-delta.vmdk
-rw------- 1 root root 323 Oct 4 12:31 Automation-000001.vmdk
-rw------- 1 root root 28332 Oct 4 12:31 Automation-Snapshot1.vmsn
-rw------- 1 root root 32212254720 Oct 4 12:28 Automation-flat.vmdk
-rw------- 1 root root 8684 Oct 4 12:31 Automation.nvram
-rw------- 1 root root 529 Oct 4 12:28 Automation.vmdk
-rw------- 1 root root 464 Oct 4 12:31 Automation.vmsd
-rwxr-xr-x 1 root root 2615 Oct 4 12:31 Automation.vmx
-rw------- 1 root root 292954 Oct 4 12:31 vmware-1.log
-rw------- 1 root root 155274 Oct 4 12:31 vmware.log
/vmfs/volumes/5b5756e6-af674044-1b69-ac1f6b0ded4e/Automation # du
7546896
Judging by «ls», the file sizes did not decrease, but judging by «du», the total size of the virtual machine decreased by 26 GB and the hypervisor before the transfer showed that the STORAGE USAGE was already 34 GB and after that it became about 8 GB. That is, the transfer has reduced the disk space.
But when I moved another virtual machine, about 1TB in size, also with one snapshot. Unfortunately I did not make the same detailed measurements. But judging by the STORAGE USAGE, this virtual machine did not decrease or decreased so slightly that I did not see the difference.
It turns out that the transfer does not always reduce the size occupied on the disk.
Perhaps someone can explain what the catch is.
I also thought of two ways that might possibly help - please tell me if they help in this matter. But so far I have not conducted any experiments, I decided to consult with the community.
3) Export VM to OVA file and than import it back.
4) Backup VM with, eg. ghettoVCB and than restore it back.
What can you advise on this issue? What methods do you use to solve this problem?