Linux VM (tmpfs)

What is tmpfs and its practical usage??

It is nothing but implementation of traditional shared memory concept. It is an efficient means of passing data between programs. One program will create a memory portion, which other processes (if permitted) can access. This will result into speeding up things on Linux.

shm / shmfs is also known as tmpfs, which is a common name for a temporary file storage facility on many Unix-like operating systems. It is intended to appear as a mounted file system, but one which uses virtual memory instead of a persistent storage device.

tmpfs is a file system, which keeps all files in virtual memory. Everything in tmpfs is temporary in the sense that no files will be created on your hard drive. If you unmount a tmpfs instance, everything stored therein is lost. By default almost all Linux distros configured to use /dev/shm. And you can specific your own tmpfs location, like as make tmpfs for squid cache /var/spool/squid.

Resize tmpfs ramdisk:

[root@alanstudio]# vi /etc/fstab tmpfs /dev/shm tmpfs rw,size=1024M 0 0
[root@alanstudio]# umount tmpfs [root@alanstudio]# mount -a

make tmpfs for squid cache

[root@alanstudio]# mkdir -m777 /var/spool/squid
[root@alanstudio]# vi /etc/fstab tmpfs /dev/shm tmpfs defaults 0 0 tmpfs /var/spool/squid tmpfs rw,size=256M 0 0
[root@alanstudio]# umount tmpfs [root@alanstudio]# mount -a

Server is hosted by Alanstudio
Linux Operating System

Recommend screen resolution 1024 x 768 / IE / FireFox
Alan Studio © 2007 by Alan Cheung Hin Lun. All rights reserved.