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

Re: putting "/tmp" to memory help



Dne, 23. 01. 2011 15:08:27 je Henrique de Moraes Holschuh napisal(a):
On Sun, 23 Jan 2011, kellyremo wrote:
> "to memory" means: mounting a ~2 GByte filesystem [ tmpfs?, or ramfs? ], > and put the "/tmp" on it. [ e.g.: 4 GByte ram in the pc ]. what to write
> in the "/etc/fstab"?

tmpfs /tmp tmpfs defaults,nosuid,nodev,mode=1777,size=1G

In squeeze, edit /etc/default/tmpfs:
SHM_SIZE=6G
TMPFS_SIZE=1G
RUN_SIZE=10M
LOCK_SIZE=1M
RW_SIZE=10M

(adjust to your needs).

> Disadvantages: - Security? [ how to set this up to be secure? any clear
> howtos/links regarding it? :O ]

tmpfs does not support security labels in 2.6.32, which limits SELINUX
heavily. There is no workaround (unless Debian backported the support to 2.6.32, I didn't check). Switch to per-user TMP directories is recommended.

--
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

Isn't messing with volatile /tmp somewhat a moot point, given that the Linux memory manager manages virtual memory anyway? I mean, if /tmp is heavily used by your system, it will be cached in memory anyway. With 4 GB of RAM (as mentioned by kellyremo), you'll end with probably your entire payload (and not just your /tmp) running from RAM. So what's to be gained with a /tmp in RAM, really? In addition, there is a possibility that dedicating 2 GB of RAM to /tmp, you could end up forcing your system to start swapping out. Which would instantly defeat any speed improvement(s) you might have gained. Linux memory management is quite competent all-round IMHO, and it would take an extremely specific/border/particular user case to warrant moving /tmp to a RAM disk.

Any opinions?
--
Cheerio,

Klistvud http://bufferoverflow.tiddlyspot.com Certifiable Loonix User #481801 Please reply to the list, not to me.


Reply to: