Having /var/run separately mounted?

Michael Neumann mneumann at ntecs.de
Tue Apr 28 03:31:32 PDT 2020


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


More information about the Users mailing list