Update ZRAM ztab settings

  • Platform information:
    • Hardware: Rpi4/4GB/SD card
    • OS: openHABian
    • Java Runtime Environment: 11
    • openHAB version: 3.4.4
  • Issue of the topic:

Hello,

my log stopped working after I added new items. I had the issue before some years ago and it was caused by ZRAM exceeding the mem_limit. In the past it helped to increase the mem_limit and disk_size in ztab.
I checked ztab again and I saw that it still had a target_dir of openhab2/persistence, which does not exist anymore. This is my config before I did some changes:

# swap	alg		mem_limit	disk_size	swap_priority	page-cluster	swappiness
swap	lzo-rle		200M		600M		75		0		150

# dir	alg		mem_limit	disk_size	target_dir			bind_dir
dir	lzo-rle		150M		1000M		/var/lib/openhab2/persistence	/persistence.bind

# log	alg		mem_limit	disk_size	target_dir		bind_dir		oldlog_dir
log	lzo-rle		300M		500M		/var/log		/log.bind

So, I updated it to the target_dir to “/var/openhab/persistence” and changed the algorithm of “dir” and “log” from “lzo-rle” to “zstd” (I saw on github that zstd is used instead of lzo-rle…). Furthermore I reduced the log-size from 16 to 10 MB,
But openhab, zigbee2mqtt and mosquitto did not start anymore because of missing log folders/files. All log files in the log-folder were removed. I did not want to fix everything so I used a backup.

Now my questions:

  1. should I update the target_dir? If yes, how? Just add an additional line? Or modify the existing line?
  2. does it make sense to update the algorithm?
  3. the relation of mem_limit = 150M and disk_size = 1000M does not really fit. Can I change it to 300M and 500M?

Sorry, I am not really an expert using ZRAM…

Thanks and best regards,
Tim

In all likelihood the problem was that the subfolders below /var/log didn’t exists and the users running mosquitto and zigbee2mqtt do not have permission to create the folders.

Look to see what folders exists under /var/log and their ownership and permissions. After creating the zram map, make sure to recreate those folders with the same permissions and ownership. Then all the services should be able to start as they always have.

Beyond that, I’m not much of an expert in zram either. My best guess is:

  1. For all we know what you already did worked. The problem you’ve reported didn’t come from OH’s embedded persistence add-ons.

  2. I don’t know the pros and cons of each algorithm. I doubt it will make a perceptible difference either way.

  3. What do you mean by “does not fit”? Reducing the disk_size is unlikely to make something too big fit.

Thanks for the answer! yes, I tried to do this for zigbee2mqtt and it was running again. But it was even easier to just use the backup.

ok, let me try again…

Then I will just leave it unchanged for now.

I meant to reduce the disc_size to 500M. From my experience increasing is easy, but decreasing might cause issues…