[Gllug] Question on /dev/shm

John HEARNS john.hearns at cern.ch
Wed Jul 10 09:54:48 UTC 2002


>From the kernel documentation on tmpfs:



"Tmpfs is a file system which keeps all files in virtual memory
....

1) There is always a kernel internal mount which you will not see at
all. ....


 2) glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for
    POSIX shared memory (shm_open, shm_unlink). Adding the following
    line to /etc/fstab should take care of this:

         tmpfs   /dev/shm        tmpfs   defaults        0 0

    Remember to create the directory that you intend to mount tmpfs on
    if necessary (/dev/shm is automagically created if you use devfs).

    This mount is _not_ needed for SYSV shared memory. The internal
    mount is used for that. (In the 2.3 kernel versions it was
    necessary to mount the predecessor of tmpfs (shm fs) to use SYSV
    shared memory) "


OK - so far so good.
/dev/shm appears mounted as a world-writeable filesystem.

It is possible to write files to it, and use up memory.

Can I ask for the opinions of the assembled sages their opinion?


Thoughts about NOT mounting /dev/shm, to stop users using  this
as a free scratch area.
>From the above documentation, if /dev/shm is not mounted, then only
POSIX shared memory calls would be affected (which aren't very common).
Will things break horribly?

My personal opinion is to leave it mounted, and not fool with things.
But I'd like to hear from the experts.




-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list