Since the vmdk with HASS OS currently requires twice the amount of space than HASS OS is actually using inside the VM, I tried to reclaim the unused space, to.shrink the vmdk using the defragment and compact buttons in the VM options, this did not reclaim any unused space. For Windows VM’s there’s a clean up disk button, which is missing with the HASS OS VM.
Then I remembered that with Linux guests, a command needs to be run inside the VM, with Ubuntu that’s “sudo vmware-toolbox-cmd disk shrink /”, this requires VMWare Tools or open-vm-tools to be installed.
So far I haven’t found how to do this in HASS OS. Can the vmware-toolbox-cmd tool be added the HASS OS?
@Hedda@dvbit The VMDK has shrunk to about half of what it was just now
Turns out two things need to be done:
SSH to HASS: cat /dev/zero > zero.fill;sync;sleep 1;sync;rm -f zero.fill
After shutdown VM on Windows host: vmware-vdiskmanager -k “C:\pathtoVMDK\haos_ova-6.2.vmdk”
Just leave it running for a couple of minutes, looks indeed like it hanged, it’s not (check hdd LED on host-pc, should blink a lot). At some point it will give a not enough storage space available warning, this can be ignored since file will be deleted.
I was running HAOS as VM on VirtualBox (Windows host) for almost 2.5 years before switching to VMware Player 17 (free version) around middle of 2023. However by Nov-2023 I came across the same challenge as the OP … ever growing vmdk file for that VM.
Searching HA community forum brought me to this post (from 2021) and I am happy to report that zero.fill command worked great through addon “Terminal & SSH” using Web UI (found on Info page after installing that addon; no need for Putty when using Web UI). Thanks @bartgrefte And for the second step I found that one does not have to use vmware-vdiskmanager utility (some folks may not have it on their system anyway, like me using free version of VMware). The same can be achieved using “Compact” button in VM options in VMware Player 17 (after shutdown VM on Windows host): Edit vm settings > Hardware > Hard Disks > Disk Utilities > Compact
Using this method my HA vmdk file reduced from 9+ GB to 4+ GB (almost 50% reduction!)
Pre-req: Install & setup the “Terminal & SSH” addon for HA to access backend (requires advanced mode)
Step 1: Use HA > Settings > Add-ons to access “Terminal & SSH” and use “Open Web UI” (found on Info page of that addon) to execute the following command at the Linux command line:
This may run for a while depending on amount of space used in your HA instance. You may see a message about not enough storage space available; this can be ignored.
Step 2: In WMware Player 17, stop or shutdown your virtual machine for HA, then use Edit vm settings > Hardware > Hard Disks > Disk Utilities > Compact.
This may run for a while depending on size of your virtual disk/vmdk file. The Disk Utilities section also shows the size of virtual disk/vmdk file, so if you like you can note/copy the before & after numbers from this same screen.