what's /dev/shm

Dag Wieers dag at wieers.com
Fri Jan 6 12:06:23 UTC 2006


On Thu, 5 Jan 2006, Suhas Kamble wrote:

> Any ideas how the size of /dev/shm is decided? Can we increase it by any way?
> We're testing it to mount as a filesystem and see if we can use it for temp
> area for one of our application. We're running RHEL ES3.0
> 
> mount -t tmpfs /dev/shm /mnt/shm
> 
> the output is
> 
> /dev/shm              3.0G  8.0K  3.0G   1% /mnt/shm
> 
> has anyone used it? Are there any security hazards?
> Any inputs towards this will be greatly appreciated. regards,

/dev/shm is half of your physical memory by default.

Filesystem options are described in the mount manpage. See tmpfs.
You have the following options:

       size=nbytes
              Override default size of the filesystem.  The size is given 
              in bytes,  and  rounded  down  to  entire pages.  The 
              default is half of the memory.

       nr_blocks=
              Set number of blocks.

       nr_inodes=
              Set number of inodes.

       mode=  Set initial permissions of the root directory.

Since you can change the permissions of the root directory, you can use it
for whatever purpose you like, without being a security problem. Beware 
though that it is temporary space, a power cycle will cause all data to 
be lost. So be careful how your programs are designed to make use of it.

I'm using tmpfs for doing RPM builds, it helps keeping disk-access low. If 
one has lots and lots of memory, one could even put whole chroots onto 
tmpfs to have no disk-access during builds. Unfortunately I don't :)

Kind regards,
--   dag wieers,  dag at wieers.com,  http://dag.wieers.com/   --
[all I want is a warm bed and a kind word and unlimited power]




More information about the redhat-list mailing list