Space issue with HAOS on Proxmox 8

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

Hi @swa72 did you ever found a way to create such cron job? I would love to run fstrim more often too. :frowning:

@pedromfa Since you can’t just use the OS shell to edit the timer like this

# systemctl edit fstrim.timer
Failed to create parent directories for '/etc/systemd/system/fstrim.timer.d/override.conf': Read-only file system

you have to find other ways but every method is hacky.

One way is to do it from the PVE side via this

qm guest exec VMIDHERE -- fstrim -av | jq -r '.["out-data"]'

It looks like this

# qm guest exec 103 -- fstrim -av | jq -r '.["out-data"]'
/tmp: 0 B (0 bytes) trimmed on /dev/zram2
/mnt/data: 166.3 MiB (174424064 bytes) trimmed on /dev/sda8
/mnt/overlay: 0 B (0 bytes) trimmed on /dev/sda7
/mnt/boot: 31.2 MiB (32706560 bytes) trimmed on /dev/sda1

Just put it in a crontab.

Another way is to do it via the Advanced SSH Addon but you need to find a way to shedule that

# docker run --rm --privileged --pid=host -it alpine:latest nsenter -t 1 -m -u -n -i sh -c "fstrim -av"
/tmp: 11 MiB (11538432 bytes) trimmed on /dev/zram2
/mnt/data: 204.4 MiB (214376448 bytes) trimmed on /dev/sda8
/mnt/overlay: 0 B (0 bytes) trimmed on /dev/sda7
/mnt/boot: 31.2 MiB (32706560 bytes) trimmed on /dev/sda1

The best way is to ask the devs to support altering this but for now these would be the workarounds I can think of. I’m not aware of a official/supported way to change this.

Nope, not really - sorry.

This solution by @Impact works perfectly:

qm guest exec VMIDHERE -- fstrim -av | jq -r '.["out-data"]'

For those who are not familiar with the system (or borderline IQ like me), you have to launch the node shell (not the VM’s) and:

  • run apt install jq to install the jq package (to better read the output)
  • replace VMIDHEREwith the ID of your HA VM
  • run crontab -e and insert the completed command with your desired schedule
  • for example, to run every day at 5:30 am on the VM 101: 30 05 * * * qm guest exec 101 -- fstrim -av | jq -r '.["out-data"]'

Cheers

PS: check out the post below for important additional info

Great additional information. I’m never really sure how much in depth I should go but I’m happy to elaborate if something’s unclear. I might add that jq and fstrim's v argument is mostly for the command issuer to have pretty output when issuing it manually or when you set it up so cron mails you the result of it.
You could also just use this to have it be silent

/usr/sbin/qm guest exec VMIDHERE -- fstrim -a > /dev/null

In cron jobs it’s a good idea to use the full path to the executable (find out via which jq) like above as $PATH is often very minimal in comparison to your normal shell.