[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: tmpfs and /tmp vs. /dev/shm



Paul Morgan <paulswm@earthlink.net> writes:

> Both are OK.  You can have more than one tmpfs mount. tmpfs maps the
> mounted filesystems into VM.
>
> For an intro, take a look at :
>
> http://www-106.ibm.com/developerworks/library/l-fs3.html

If for whatever reason you want to have only one (e.g., you have a
monitoring system that gets confused otherwise, like myself), and you
have a >2.4 kernel, you can do this in /etc/fstab as a work-around:

tmpfs    /dev/shm tmpfs defaults 0 0
/dev/shm /tmp     none  rw,bind  0 0

You can't just use the bind mount (the second line) because that will
happen before /dev/shm is mounted by the init script.  This may seem to
work, but only because you're using the directory /dev/shm (i.e.,
usually part of the root filesystem) instead of the tmpfs filesystem.
So instead you mount /dev/shm in fstab (which the init script checks
for), and bind-mount that to /tmp.

-- 
Jeremy Hankins <nowan@nowan.org>
PGP fingerprint: 748F 4D16 538E 75D6 8333  9E10 D212 B5ED 37D0 0A03



Reply to: