Question on tmpfs. [Solved]

Discussion in general that pertains to Sabayon Linux - Must Pertain to Sabayon Linux

Moderator: Moderators

Question on tmpfs. [Solved]

Postby Gara3987 » Wed May 01, 2013 1:20

On the front page; the press release : Sabayon 13.04, it is stated :

/tmp is now mounted on a very small tmpfs with nodev,noexec,nosuid options by default for greater security. Some exotic programs that insist on writing to /tmp may fail to run and they should be fixed upstream. Writing to /tmp is bad, and you should not use any software that behaves like this.

I am trying to understand how exactly tmpfs works; with no real success. From what I was able to gather, tmpfs uses the RAM (up to 50% by default) and then uses SWAP when that limit is met. So what exactly is going on with the /tmp directory? Would the SWAP partition need to be expanded for larger temporary data?

Also, I like to give the /tmp its own partition so that my root partition is untouched when backing up CD/DVDs, or when I am doing audio and Video editing.

If tmpfs is being utilized, would it even be necessary to dedicate a partition to the /tmp in the first place at this point?
Last edited by Gara3987 on Sat May 04, 2013 0:55, edited 1 time in total.
Baby Hen
Posts: 11
Joined: Fri Aug 03, 2012 4:59

Re: Question on tmpfs.

Postby manifesto » Wed May 01, 2013 21:07

On my machine I have :
Code: Select all
sabayon ~ # grep tmp /etc/fstab
tmpfs                   /dev/shm                tmpfs   defaults        0 0
tmp     /tmp      tmpfs rw,mode=1777 0 0
sabayon ~ # df -h /tmp
Sys. de fichiers Taille Utilisé Dispo Uti% Monté sur
tmp                1,9G     13M  1,9G   1% /tmp

/dev/shm is a view onto the memory. Then using tmpfs makes this memory available as file system like device.
To change this behaviour you just need in fstab to comment tmpfs line and then change the 2nd one with something like /dev/sd3 /tmp ext4 ....
Then umount/remount /tmp or reboot.
Explanations on tmpfs
Usually RAM + swap is seen by unix kernel as one single memory space. So whenever RAM is needed pages are arranged between disk/RAM according usage frequency of those memory pages.
This would be the same for your tmpfs.

So in your case of you need huge tmpfs it can make sens to have dedicated physical partition to not eat all your RAM.
You can however make a big tmpfs (RAM + SWAP) with growing swap but you may spend all your time with paging from RAM to SWAP.
Growing Hen
Posts: 180
Joined: Mon Jul 19, 2010 22:21

Re: Question on tmpfs.

Postby Gara3987 » Sat May 04, 2013 0:54

Thanks for the reply, that really does help.
Baby Hen
Posts: 11
Joined: Fri Aug 03, 2012 4:59

Return to Sabayon Linux General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests