Having /var/run separately mounted?

Martin Ivanov martin.ivanov at greenpocket.de
Tue Apr 28 04:51:23 PDT 2020


Hello Michael,

Thank you very much for your quick reply. Your suggestion with null 
mount worked. Actually, I had tried that already, but I had not cpdup-ed 
the contents of /var/run in advance to /build/var.run. Thanks to you, 
now I have /var/run null mounted under /build, great!

Regarding your second suggestion, I guess you meant I should search for 
'run', not for 'var'? I saw the directories that have to be created in 
mountcritlocal. I also think your solution for tmpfs as /var/run will 
work. However, as I am satisfied with the null mount under /build and I 
avoid modifying system scripts, I guess I am not going to implement it.

Thank you very much again!

Best regards,

Martin


On 28.04.20 12:31, Michael Neumann 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

-- 
Dr. Martin A. Ivanov
GreenPocket GmbH - Kundennähe durch Smart Metering -
Labor 3.09 | Schanzenstraße 6-20 | 51063 Köln
Telefon           +49 | 221 | 355095-0
Fax                   +49 | 221 | 355095-99
E-Mail              martin.ivanov at greenpocket.de

Webadresse  www.greenpocket.de



More information about the Users mailing list