The tmpfs file system:

The tmpfs filesytem lives in the RAM, which allows fast access to the files created in it. 
The tmpfs filessytem also adapts its memory consumption to its usage and size. 

The tmpfs can use the swap space on the disk if the RAM gets exhausted.

All the files we create in the tmpfs filesystem are stored in the RAM.


We could consider the tmpfs as an improved version of the ramdisk - /dev/ramXX -, which could not be resized nor swapped out to disk

Mounting a tmpfs filesystem:

To mount a tmpfs filesystem, we use the below command:

  •  -t : type of the filesystem - tmpfs -.
  •  none: tmpfs doesn't need a filesystem, so we set it to "none".
Giving "tmpfs" a size:

Mounting a "2G" "tmpfs" filesystem on the "/tmpfs-mount" directory.


To avoid the tmpfs filesystem filling up the whole memory, we need to unmount it after we are done using it, using the "umount" command.

Recent Linux system mount the tmpfs filesystem on the shared memory device "/dev/shm".

Brando Sabatini and Ikbal C ©. Powered by Blogger.