Home Assistant VM size

What is the expected VM size for HA? Mine has 40 GB, and is pushing the limits.

This time, it’s not that the logs are out of control.

I can of course just resize it, but I can’t seem to find what is taking up all that storage. The largest file or directory I have been able to locate is a backup of 1.22 GB, second largest is the www directory that is 174 MB.

Any idea where I should look? Or is this a sensible size (going to 50 GB) with no obvious culprits sticking out?

EDIT: I can’t see any add-on sizes via Samba shares, is there some way to see this from the UI?

use the cli and the command “ls -la” to view directories.
The l (L not a capital i) will make the output in long format where you can see size and more.
The a will let you see hidden directories, which in Linux is the ones starting with .

I should have mentioned, I was using du -sh (which gives the total size of directories). This does not show anything useful.

Aside from the one backup, not a single directory is more than ~300 MB (config/), and combined (du -sh /) is only 2.8G.

Output of du -sh /*

4.0K	/addons
1.7G	/backup
2.3M	/bin
52.0K	/command
301.2M	/config
44.0K	/data
0	/dev
2.2M	/etc
4.0K	/home
4.0K	/init
7.1M	/lib
4.0K	/lib64
44.3M	/media
4.0K	/mnt
4.0K	/opt
6.0M	/package
0	/proc
11.9M	/root
616.0K	/run
268.0K	/sbin
4.0K	/share
4.0K	/srv
36.0K	/ssl
0	/sys
88.0K	/tmp
284.7M	/usr
504.8M	/var

So again, nothing really sticks out, but I’m not sure if I’m seeing everything (well, since the 40GB is almost used up, I’m obviously not. But I don’t know where else to look).

1 Like

Update:

Disabling safe mode on the “Advanced SSH & Web Terminal” and running docker system df shows:

TYPE            TOTAL     ACTIVE    SIZE      RECLAIMABLE
Images          47        27        16.65GB   8.849GB (53%)
Containers      27        24        38.72MB   136.2kB (0%)
Local Volumes   0         0         0B        0B
Build Cache     0         0         0B        0B

Doing docker image prune reclaimed a few GB (didn’t want to to docker system prune or docker image prune -a, just to be sure).

But that still only accounts for less than half of the used storage in the VM (17 GB in docker, 2.8 GB for root system and everything accessible via ssh)

doesn’t haos run like raid 0 with a clone parition? (I could be wrong)

du * might be the reason.
I do not think it count as hidden files also.

There should be at least one hidden directory called .storage or something like that.

The accepted answer in your link states (and show) that du does parse hidden directories (but not when using wildcard *. So if I understand it correctly, hidden would be included in the summary when du -sh /), but not listed with du -sh /*).

I also tried du -h /config just to be sure, and it does list the .storage, .idea, etc. directories.

Just for kicks, I also tried du -hs /config/.[^.]* to specifically list the hidden directories (did the same for /media/, /backups/, /addons/, etc.), and this does not seem to be what’s taking space:

4.0K	/config/.HA_VERSION
4.0K	/config/.cloud
8.0K	/config/.google_maps_location_sharing.cookies.REDACTED_gmail_com.txt
52.0K	/config/.idea
8.0K	/config/.ssh_keys
6.0M	/config/.storage

That means you do not have anything big stored somewhere, like backups.
If the size you see is in the hypervisor, then it is probably the inflated disk you see.
The disk will inflate when it uses the space for different stuff, like backups, and it will not go down again unless you shrink it manually or schedule the hypervisor to do it.
The problem here is that the hypervisor needs guestOS utilities installed, so it can move the files on the virtual file system to the beginning of the virtual disk but these guestOS utilities might not be available some of the HA installation forms, like HAOS.

The VM has 40 GB allocated, and that i of course the size of the *.qcow2 image (is that what you mean by size in hypervisor?).

The “problem” with the disk being almost full is that Home Assistant is complaining about this in the HA UI (after running docker image prune I now see 6.4 GB free in the UI*, but before that it shows 90+ % used and 0.9 GB free and had warnings in my HA notifications).

*I am using the Nextcloud backup addon, and I don’t keep a lot of backups locally. The 6.4 GB free is after upgrading a few things, so some of the large auto-backup files have been automatically cleaned locally, freeing up a but more.

Yes the qcow2 size is the size that the hypervisor have allocated to the guestOS.
This file is typically set up to be growable In the hypervisor, unless you specifically set it to a fixed size.
A growable file will expand when you do things like backup within HA, which will most likely be done locally and then copied to your remote location afterwards.
Once the qcow2 file have grown it can be hard to shrink it again without guestOS utilities to prepare the disk allocation within the VM.

Sure, I’m OK with a 40 GB qcow2 image, I just don’t get why HA seems to see the (40 GB) disk as almost full. I could increase this, I don’t want to do this unless I need to.

I can see that deleting dangling docker images or old backups reduces this disk usage (in HA), but I can only find folders/files to account for less than 20 GB (incl. backups), so I’m trying to figure out if there’s some large chunk of junk somewhere I should do something about.

In short, what am I not seeing when listing all (incl. hidden) files and folders after SSH to the VM using Advanced SSH & Web Terminal (or just going over them in Finder using the Samba share add-on) and also listing all docker images (which don’t seem to be shown with ls, du, or anywhere in the Samba shares)?

Try to run “lsof | grep -c DEL”
If the number is not 0, then reboot your system not just HA, and run it again.

lsof | grep -c DEL returns 0.

Ok and have you looked for other filesystems in the VM?
Maybe like swap.

Is there swap in HassOS? I just installed the qcow2 image like this, so I don’t think I have added any swap manually.

If there is, how would I see/find this?

try lsblk to see the partitions

You mean from within the VM? No can do.

➜  ~ lsblk
zsh: command not found: lsblk

No idea, how to do it then.
I would use parted, fdisk or lsblk on a normal Linux/Debian, but no idea what is available on the HAOS image.

Ok, thanks for the suggestions anyway