Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I run df -h and found on my Debian Squeeze two tmpfs directory,

tmpfs                 1.5G     0  1.5G   0% /lib/init/rw
tmpfs                 1.5G     0  1.5G   0% /dev/shm

Then, I added a line in my /etc/fstab as following,

tmpfs   /tmp	tmpfs	size=1g		0 0

and I rebooted Debian and found /tmp mounted successfuly.

tmpfs                 1.0G  236K  1.0G   1% /tmp
tmpfs                 1.5G     0  1.5G   0% /lib/init/rw
tmpfs                 1.5G     0  1.5G   0% /dev/shm

My physical memory's size is 3GB. I wonder: Is the three tmpfs either all resided on the memory(Is that possible?) or extended to the swap?

share|improve this question
up vote 4 down vote accepted

My physical memory's size is 3GB. I wonder: Is the three tmpfs either all resided on the memory(Is that possible?) or extended to the swap?

tmpfs only uses memory when you fill it with files. So as long as it is empty, it will take almost no space in RAM.

share|improve this answer

Comprehensive information about tmpfs can be found on IBM DeveloperWorks. In short, tmpfs can use swap as well, whereas ramfs devices are memory only. I recommend you read the DeveloperWorks article when you have time though, it is very detailed, and one of the best articles I've read.

Regarding /dev/shm specifically, it is there for POSIX compliance; Debian is huge on standards compliance. From a Red Hat mailing list post:

/dev/shm is for POSIX compliant shared memory and very few applications even need/use this.

share|improve this answer
2  
PulseAudio will use /dev/shm if present. linux.die.net/man/1/pulseaudio – nagul Oct 5 '09 at 10:12
    
Seems the link to drobbin’s article is broken… – binki Sep 6 '15 at 17:20
    
I asked developerworks for the article and they emailed me this PDF of “Common threads: Advanced filesystem implementor’s guide, Part 3” with the disclaimer that it was removed because it was out of date. – binki Sep 9 '15 at 15:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .