VMware VMDK Huge

Hi Everyone,

My HAOS system has been running fine for years in VMWare, I have recently noticed the VM has got huge despite despite only about 70-80gb used:

The VM is nearly 500gb and my VM backups are the same!

Usually in this situation I would zero the free space with DD then shrink the VMDK however I cant do this due to the read-only nature of HAOS

There are no snapshots and I have consolidated but still the same, does anyone have any idea how I can fix this?

Thanks

How is your VM storage configured in ESX? What storage browser shows for this particular file?

It is set as thin provisioned this is what the browser shows for the VMDK:

This is explained on the Broadcom support site:

Deleting data from Guest OS only removes the data from the file allocation table but does not zero the blocks. As a result, the ESXi Host still sees the blocks in use even after deleting the data.
Reclaiming disk space from thin provisioned VMDK files when ESXI Host still sees blocks even after removed from GuestOS

I would not provision a disk that large to HA unless you absolutely need to. If it is for backup purposes, rethink your backup strategy (keep the backups away from your VM)

1 Like

@fleskefjes is right. I personally have disk size set to 48GB, but it only after years of usage, when all add-ons and backups consumed old 32GB allocated…
Reclainng this space might be a bit tricky now. I’m not ESX expert, but few strategies I can imagine:

  • Backing up your HA configuration using internal backup, creating new machine with smaaller disk and restoring configuration from backup.
  • Using external backup tool (like Synology Active Backup), that uses ESX snapshots, to backup whole machine and restore it server as new VM. Reducing the disk space to something reasonable prior to booting it for the first time. Though I’m not 100% sure if this do the trick :thinking:
2 Likes

I would think this is the easiest way, but of course make sure that you export the backup first. You could have the old vm powered off, and then delete it once you are up and running correctly on the new vm.

Thanks I did try that with Veeam but the backup was still massive.

Is there anyway I can take the fs out of read-only mode to run the dd command?

1 Like

Veeam takes backup of the vmdk. Use the HA backup feature, export it and then re-import it to a fresh vm with less disk space. 60 GB should be more than enough for most users.

2 Likes

Im cant remember what customisations etc I have so im a bit wary of doing that method.

I have a lot of solar/power data being stored and I want to keep it so would probably need 150-200gig.

Your screenshot shows 69GB, but the sizing is up to you. There is nothing to be wary about, you don’t need to delete the original vm until you are satisfied the result is what you want. Just turn it off.

1 Like

I just tried to use Veeam and it was set to skip any unused space however it still copied it all, thats odd it usually works, there is something about the space in this VMDK/file system that is not right.

It’s all explained in the support article I linked you. Since the blocks are not zeroed, the vmdk shows it as consumed space. The blocks contain data, it’s just that HAOS (not veeam) knows that the blocks are available to overwrite (“free space” in HAOS). Veeam is not the correct tool for this. Use the method I outlined earlier. When you have a new vm up and running, then Veeam is perfect (I use it myself).

1 Like

Kinda strange that fstrim doesnt work here. Are you able to enable discard or something like that?

1 Like

IIRC Veeam usually ignores deleted but not zeroed blocks on certain operations. Its a shame HA has no way of zeroing out the deleted blocks and I need to reinstall to resolve this

1 Like

I dont think VMWare has that option

1 Like

So I managed to do this by using the developer SSH connection which allows you full rights: Debugging the Home Assistant Operating System | Home Assistant Developer Docs

I managed to get the 500GB VMDK down to under 70gb

Here is a rough guide incase anyone else has this in the future:

1.) Enable developer mode and connect via SSH
2.) Run DD, delete the file then run VMFSTools as per: Reclaiming disk space from thin provisioned VMDK files when ESXI Host still sees blocks even after removed from GuestOS

Of course this doesnt stop it happening again in future so im going to look in to shrinking the partition/file system but that doesnt look too easy

Did you get the vmdk resized also? Or is it still 1TB?

Still 1tb I tried resizing with Gparted however that didnt shrink the file system so I have gone back to a backup, more research required as im not super experienced with ext4

I see. So really not a solution, just a temporary workaround then :slight_smile:

Well yeah but it took over 5 years to get to that size before so it buys me a lot more time lol