Having /var/run separately mounted?

Martin Ivanov martin.ivanov at greenpocket.de
Tue Apr 28 09:23:56 PDT 2020


Wow, that would be great, Aaron, thank you!

On 28.04.20 14:11, Aaron LI wrote:
> On April 28, 2020 6:31:32 PM GMT+08:00, Michael Neumann <mneumann at ntecs.de> 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,

-- 
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