Problem :
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?
Solution :
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.
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.