Space issue with HAOS on Proxmox 8

I am not very familiar with Proxmox, but it might need some tweaks in the virtual disk configuration? In your config, the LVM Thin disk is attached as a “raw” disk to the HAOS VM?

The script shared in Installing Home Assistant OS using Proxmox 8 adds discard=on,ssd=1 to the virtual disk configuration, maybe that helps? :thinking:

FWIW, HAOS runs a fstrim systemd service once a week. This should help for underlying disk systems to understand which blocks are actually free. So after enabling above options, it might take a while for virtual disk/Proxmox to learn which blocks are actually free.

Damn, I must start to read the posts more carefully.
I read it as problems with the size in HA and not with the size of the VM.

A VM stores the files on virtual file system. It stores them as if it was a physical disk and that means it will put them where ever there is space for it.
Because the system also create and delete files all the time, then the system will eventually have files thrown out over the entire file system space.
This means that when Proxmox backs up your VM, then it will backup from the first file to the last file and also all the empty areas in between.
Proxmox can not see the empty areas and it can not repack the disk, so all the files are next to each other without any empty space.

When HA makes a backup, then it see the files and ignore the empty spaces.

  1. Well, the VM can see the Proxmox backup folder because it’s mounted in HA as backup folder too. they use different subdirs. Probably not the best practice…

  2. I didn’t notice the latest backup’s size when posting the screenshot! I’ve just run a new backup and it seems that the new size is correct, at around 3.5 GB. Maybe what posted @agners below did the trick?

Anyway, it looks like it’s solved. Thanks a lot for the help!

Where can I see when fstrim is run? Something happened last night and the size is now magically correct.

I used the LVM-Thin storage type, so it should skip the empty space. Any, it seems resolved now. Thanks for the help.

1 Like

On the VM’s system terminal, you can check the latest run by using login to gain OS shell access, then:

systemctl status fstrim.service

I guess that was it!

Thanks a lot!

1 Like

LVM-Thin reserves space as it is using it, but it will still contain free space between files, because the hypervisor (Proxmox) are not able to see the actual file system inside the VM.

This is exactly where fstrim comes in: It uses modern protocol features of virtualized/paravirtualized block device to tell the underlying hypervisor which blocks are actually unused by the file system inside the VM. This way a thin provisioned block device can actually free up unused disk space.

True, but it is the VM that tells the Hypervisor.

is there any possibility to repack database outside home assistant? I mean download db and repack in PC. There is not enough space on the disk with proxmx where HA is running, repack will end with an error in Proxmox when the disk is full.

Repacking a DB is not like using zip or another compression tool.
A repack means another database is created and every post not marked for deletion is copied over and then the databases are switch around on the server and the old one is deleted.

You have two easy options and that is to give the HA installation a bit more space in Proxmox and then restart HA, which will then automatically claim the extra space or you could do bigger purge, so the repacked database will not contain that much data, but this of course means you will lose some LTS data.

thanks for the info, I was hoping that it could be done with some command, just as I was able to fix the databases thanks to the HA forum (forum ). Unfortunately, in Proxmox I can’t give HA more space, so I can’t do that, I can’t change the size of Local-lvm (although I asked about it on the proxmox forum, that procedure is beyond my experience)
i found sqlite VACUUM command this is like repacking in HA?

If you have the space on the disk, then it is easy in Proxmox to add a bit more to the VM.

Just remember that the value you in the next window is the space you want to add and not the space you want as a total for the VM.
Just restart the HA host and not just the core afterwards and HAOS will do the rest.

yes I know this, I increased it, but my local-lvm fills up,
I don’t have disk space, I have 80GB of free space on my local disk, but I can’t convert this disk space to local-lvm, I got advice on the proxmox forum, but that’s beyond my skills

Download your backups and then use the CLI to check if there are backup files in the backup directory that have not been marked as a backup. If they are there, then delete them manually.
Hopefully this can make it possible to repack your database and the backups can be uploaded again afterwards if need be.

so unfortunately, database repack failed, proxmox almost ran out of space on the local-lvm disk

I’ll try to make a backup, create a virtual machine on the laptop, start ha os there, restore from the backup, repack the database and return the databases :-), I can’t think of anything else :slight_smile:

Any option to run this regularly (more regularly than once a week)? If so, how?

I guess you could run a cron job whenever you want

Thanks, I’d reckoned that. But where? Do I login into one of the following dockers and change the cron there?

CONTAINER ID   NAMES
eabdb64c0c7f   homeassistant
2fec2db7e0cb   hassio_cli
25c13079934d   hassio_supervisor
290155cadfc7   hassio_observer