Openhabian root reserves too much space, fresh install suggestions?

I am running Openhabian, OH 3.4 on a Rpi4 and 64gb SD card, the whole setup is not even running for 1 month now.
I had several problems where I couldn’t create items, I recieved disk space error in frontail logger and also some “Persistence took tlonger than 5000ms” error.
Checking Rpi space, this is what I found out:

openhabian@openhabian:~$ sudo df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        59G  4.8G   52G   9% /
devtmpfs        454M     0  454M   0% /dev
tmpfs           487M     0  487M   0% /dev/shm
tmpfs           195M  1.8M  193M   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/mmcblk0p1  255M   50M  206M  20% /boot
/dev/zram1      347M  321M     0 100% /opt/zram/zram1
overlay1        347M  321M     0 100% /var/lib/openhab/persistence
/dev/zram2      468M   27M  406M   7% /opt/zram/zram2
overlay2        468M   27M  406M   7% /var/log
tmpfs            98M     0   98M   0% /run/user/1000

So the persistence and zram folders are full causing me errors, while the root partition is sitting on 50gb + free space? So what I tried next was removing 10gb from root partition and wanted to give the free space to the other partitions, but the Rpi isn’t booting anymore now, I think I managed to mess everything up.
I want to do a fresh OH 3.4 install now using Openhabian, and my question is, is there something to prevent this from happen in the future? How to I decide during installation that the root doesn’t need 50gb? Anybody had similar problems and has some advice? Thank you.

Edit: Clearly the best thing would be to just let every partition/folder have as much place as they need till the whole disk is full, why do they have a maximum space amount, makes no sense to me…

Not a linux or zram guru, but I think you are comparing apples and oranges. Zram is in the "volitile (hope i’m using that term correctly) " memory (In Rpi4 the 2GB, 4GB, etc. portion), not the SD card 64GB memory. The whole Zram idea is to avoid frequent writes of active folders and wear out the SD card. Depending on the size (2 GB?) of the Rpi4 you may be able to reset between Zram1 and Zram2

Correct, it’s in RAM.

Writing to an SD card wears it out. Each sector can only be written to so many times before it simply stops working. And there is usually little to no warning when this has happened.

openHAB does a lot of writes, especially with persistence and logging. Therefore, in order to extend the life of the SD card, openHABian employs ZRAM. This is a service that creates “disks” that only live in RAM. This makes it so writes take place only in RAM and do not hit the SD card. The contents of ZRAM are only written to the SD card on a normal shutdown. This can make your SD card last for a lifetime instead of wearing out in a year or so.

Given this, the only way to “just let every partition/folder” use the whole disk is to disable ZRAM. But of course that also means your SD card will wear out much sooner.

You can enable ZRAM in menu option 38 in openhabian-config. You can change the amount of RAM dedicated to an overlay by editing /etc/ztab and give the persistence disk more space. Just be aware that the more space you give it the less RAM you have to actually run programs on the machine.

1 Like

Reduce size and or number of openhab logs in $OPENHAB_DATA/log4j2.xml so ZRAM doesn’t run full.

It’s the persistence overlay that’s full for OP though. /var/log only has 7% un use.

Oh right. Interesting, haven’t encountered a system that big in a while.
Increase its size in /etc/ztab then.
Or remove it there and mount a separate USB stick to the persistence dir root so if that crashes it doesn’t affect your whole system.

Another option would be not to persist every bit in openHAB but only some Items.