tmpfs and /tmp partition

Support for security such as Firewalls and securing linux
ataylor
Posts: 34
Joined: 2008/06/25 07:36:29

tmpfs and /tmp partition

Post by ataylor » 2014/07/11 03:53:55

Greetings,

As I understand it, /tmp is by default mapped to tmpfs and swap. That would seem to suggest there is no point putting /tmp on it's own partition as the security guide still suggests ?

What am I missing ?

BRgds/Alan

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Re: tmpfs and /tmp partition

Post by gerald_clark » 2014/07/11 04:06:59

No. By default only /dev/shm, /run,, and /sys/fs/cgroup are type tmpfs.

/tmp is just a directory.

ataylor
Posts: 34
Joined: 2008/06/25 07:36:29

Re: tmpfs and /tmp partition

Post by ataylor » 2014/07/11 09:20:20

Ok, thank you ...

matteoIT
Posts: 6
Joined: 2012/02/12 18:49:42

Re: tmpfs and /tmp partition

Post by matteoIT » 2014/07/18 21:57:36

Wrrong, doesn't seems so. Using CentOS 7 x64, standard install, 8 GB Ram, no custom fstab

Code: Select all

[matteo@localhost ~]$ df
File system    1K-blocchi    Usati Disponib. Uso% Montato su
/dev/sda2        56756376  5580276  48269988  11% /
devtmpfs          4009556        0   4009556   0% /dev
tmpfs             4018484      140   4018344   1% /dev/shm
tmpfs             4018484     9084   4009400   1% /run
tmpfs             4018484        0   4018484   0% /sys/fs/cgroup
tmpfs             4018484    18308   4000176   1% /tmp
/dev/sda1          789904   122136    610424  17% /boot
/dev/sdb1       976759804 39284524 937475280   5% /run/media/matteo/Dati
Correct reply:
"/tmp is by default mapped to tmpfs"

Since i'm not using at all swap, cannot reply about this

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Re: tmpfs and /tmp partition

Post by gerald_clark » 2014/07/18 22:16:06

Then it must depend on amount of RAM.
I did a default install with 2G RAM and I do not have tmpfs for /tmp.

matteoIT
Posts: 6
Joined: 2012/02/12 18:49:42

Re: tmpfs and /tmp partition

Post by matteoIT » 2014/07/18 22:43:35

thank you for your answer, , really useful. I thought the same behavior for tmpfs for systems with less RAM
I'm wrong
but re-reading http://en.wikipedia.org/wiki/Tmpfs the definition of tmpfs had to get there by myself ... :D
if a system has little ram, is diabolical use tmpfs and then use immediately swap .. :lol:

ataylor
Posts: 34
Joined: 2008/06/25 07:36:29

Re: tmpfs and /tmp partition

Post by ataylor » 2014/07/19 03:22:11

Mmmm thanks very much for the follow up. That is what I thought:
For a reasonable amount of RAM, the default is for /tmp (tmpfs) to take up to half of RAM and then use swap.
So I think making a separate /tmp partition is just a waste of disk space - better to make swap a bit bigger ...

??

Alan

User avatar
vonskippy
Posts: 839
Joined: 2006/12/30 03:00:04
Location: Western Slope Colorado

Re: tmpfs and /tmp partition

Post by vonskippy » 2014/07/19 03:38:23

ataylor wrote:better to make swap a bit bigger
It is NEVER "better" to make swap bigger.

If you're hitting swap, it means your running applications are poorly configured.

Optimize the apps, or add ram - NEVER add swap.

Swap came from the days when ram was limited (because of hardware architecture and ram cost). It was the only way to keep things limping along due to ram shortage.

None of that's true with modern hardware.
For the 2.5^15th time :: Better Details = Better Answers

ataylor
Posts: 34
Joined: 2008/06/25 07:36:29

Re: tmpfs and /tmp partition

Post by ataylor » 2014/07/19 10:34:54

"better" in this case means better than an empty, unused /tmp partition

assen
Posts: 80
Joined: 2013/02/22 12:48:05
Contact:

Re: tmpfs and /tmp partition

Post by assen » 2014/07/20 20:45:09

The real culprit with /tmp on tmpfs (besides losing its content on reboot, which sometimes may be undesirable) is that tmpfs grows as long as there is RAM available. Now just imagine some process writing into /tmp a, say, input video stream... and the picture is not nice at all. Once upon a time some processes loved writing core files into /tmp too...

I'd advise everybody dealing with CentOS 7 to carefully consider bringing /tmp back to the disk - or, at least, engage proper monitoring of its size (because RAM usage monitor itself will not help).

WWell,

Post Reply

Return to “CentOS 7 - Security Support”