On April 28, 2020 6:31:32 PM GMT+08:00, Michael Neumann <[email protected]> wrote: >On Tue, Apr 28, 2020 at 07:14:43AM +0000, Dr. Martin Ivanov wrote: >> <div>I would like to have /var/run mounted separately as it is not a >directory to be backed up.</div> >> <div><br> >> </div> >> <div>I tried mounting it as a tmpfs or as a null mount under /build. >In both cases it did not work, because some processes write to /var/run >before it is mounted and some after that. In particular, problems arise >due to the shared memory, which has to be mounted > >Have you tried adding an entry to fstab like this: > >/build/var.run /var/run null rw 0 0 > >This should then be mounted automatically by /etc/rc.d/mountcritlocal. >Once mountcritlocal has mounted the local file systems it will create a >/var/run/shm entry. So your /build/var.run should have a `shm` >subdirectory. > >If you want to mount /var/run as tmpfs then you have to edit >/etc/rc.d/mountcritlocal slightly. Right at the end you will find: > > mount_tmpfs -m 01777 dummy /var/run/shm > mkdir -p -m 01777 /var/run/shm/tmp > >If /var/run should be a tmpfs, the `shm` directory and other >directories >will not exist and you have to create them. Take a look at >/etc/mtree/BSD.var.dist and search for `var`. You will find the >subdirectories and their modes that you have to create. Create those >directories right before the `mount_tmpfs` call above. > >Haven't tried that myself, but I think that should work. > >Regards, > > Michael
I'd like we improve the RC script and provide a configuration like 'tmpfs_var_run=YES' to mount a tmpfs at /var/run. And in such a case, we can just create /var/run/shm with mode 01777 and without mounting another tmpfs. In addition, we can do the same for /tmp. Cheers, -- Aaron
