[Techtalk] /dev/shm

Wim De Smet kromagg at gmail.com
Sat Jan 14 23:44:17 EST 2006


On 1/13/06, David Sumbler <david at aeolia.co.uk> wrote:
> In my /etc/fstab file is a line which reads:
>
> none         /dev/shm tmpfs    defaults  0 0
>
> I assume that line was added by my Fedora Core 4 system (or its
> version 2 predecessor), because I'm sure I didn't!
>
> 'df' reports
>
> none         tmpfs    316M     0  316M   0% /dev/shm
>
> And 'ls -ld /dev/shm' gives
>
> drwxrwxrwt  2 root root 40 Jan  8 16:39 /dev/shm
>
> the time being when I last rebooted the computer, I think.  /dev/shm
> itself is empty, currently at any rate.
>
> What is this, what is it used for, and by what?
>
> David
>

>From linux src: Documentation/filesystems/tmpfs.txt

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)

In short: you need this. I don't think it actually takes up any space
so you can safely leave it there.

greets,
Wim


More information about the Techtalk mailing list