Tmpfs filesystems are independent. There's no feature to limit the size of a set of tmpfs filesystems.
Tmpfs filesystems are interchangeable apart from the memory limitation, so if you want to have a combined limits, you can just combine the filesystems. Make symbolic links once and for all:
ln -s var/run/tmp /tmp
ln -s ../run/lock /var/lock
When you mount the filesystem, immediately create the required subdirectories.
mount -t tmpfs tmpfs /var/run
mkdir -m 1777 /var/run/tmp /var/run/lock
I've created the subdirectories directly inside /var/run
because that directory normally has tame file names and is only accessible to root. Do not create subdirectories inside a world-writable directory: a user could preempt you and create a directory they can write to, which would result in them owning /var/run
and so being able to create and remove files there.
mount -t tmpfs mode=1777 tmpfs /tmp
mkdir /tmp/run
/tmp
,/var/run
,/var/lock
on a singletmpfs
? Could you suggest then, please, where i should mount thetmpfs
itself, and how to create this directory hierarchy in it automatically every time?