/var/log in RAMDISK - OH2 doesn´t start anymore

i have a debian 8 Installation, where i installed OH2.

All works fine. Now i wanted to move the whole /var/log directory to a ramdisk.

I added

tmpfs       /var/log        tmpfs   defaults,noatime,mode=0755,size=15%    0    0

to /etc/fstab. But now there is no openhab2-logfile diretcory anmore, also OH2 isn´t running after a server reboot. If i remove the line in fstab and make a reboot, all is working fine again.

I also tried other combinations in fstab, but everytime the log-directory is moved to tmpfs, OH2 was not running after a reboot.

Can someone help me? What´s wrong?

Maybe… try mode=0777 (or change the ownership of /var/log/openhab2 to openhab)
OH2 runs with user openhab and maybe it cannot create the directory and then write the log.

0777 is not working.

If i change the whole /var/log to the tempfs, isn´t the ownership of /var/log/openhab2 still the same?

Without tmpfs the owner is already user “openhab”. With tmpfs i can´t test it, because there is no openhab2-directory anymore.

Why shouldn´t user “openhab” be unable to create the directory? When log-directory isn´t moved to tmpfs, then it can create it without any problem?

You have to persist the folder structure since it does not get created from the logging classes.
Or you go the easy way and save the folder once a day/week/month on the sd-card and restore it on startup.

Strange behaviour… On OH1 it worked like a charm. Without persisting folder structure.

Ok, i will try another way to do this. Maybe it works, if i only move /var/log/openhab2 folder to the ramdisk, then the folder structure should be ok?

Can i only change the place of the log directory with editing /etc/fstab or is there a possibility inside OH2 too? Maybe a configuration-file for logging?

I think that you can edit org.ops4j.pax.logging.cfg
See: http://docs.openhab.org/administration/logging.html#config-file

If you can live with losing all changes to the fs on reboot, see this: https://github.com/openhab/openhabian/issues/96

I´m on a debian installation on a real server with ssd, no sd-card.

I only want to have the logfiles in tmpfs, persistence and all the config files should stay on “real” disk-space.

I will try some more.