> ## Content Index
> Fetch the complete content index at: https://www.bagz.fr/llms.txt
> Use this file to discover other available public pages before exploring further.

# Set up RamFS or TmpFS on Linux
- URL: https://www.bagz.fr/set-up-ramfs-or-tmpfs-on-linux/
- Published: 2016-02-05T15:16:59.000Z
- Updated: 2016-02-05T15:16:59.000Z
- Author: bgazui
- Tags: Linux, #Migrated-1790668826633, #wp, #wp-post, #Import 2026-09-29 08:00

In the most modern Linux systems, you will find memory-based file systems to make access to disk storage much faster by allocating some RAM space on a disk mount point. But this means that this disk area will be ephemeral and won't exist anymore after a system reboot. You should never use it for storing persistent data, but rather using it as cache mechanism that needs speed.

As of today, the two main memory-based file systems are **tmpfs** and **ramfs**. Both have their pros and cons, depending on your needs.  
Right now, **tmpfs** is more and more used in replacement of **ramfs**.

Main differences between **ramfs** and **tmpfs** are:

### RamFS(older)

\+ Can be monitored as cached in memory with **free** \+ Is not using swap - Can't be limited in size

### TmpFS (newer)

\+ Can be monitored with **df** \+ Can be limited in size - Can use swap

## Setup tmpfs

First create the directory you will use# mkdir -p /mnt/tmpfsThen mount it as tmpfs (I'm using here 16M)# mount -t tmpfs -o size=16m tmpfs /mnt/tmpfsYou can check that it's mounted correctly (here I'm already using 21% of the tmpfs)# df -k  
Filesystem 1K-blocks Used Available Use% Mounted on  
tmpfs 16384 3384 13000 21% /mnt/tmpfs  
You can also make it automatically mounted by adding this line in your *fstab* configuration file:tmpfs /mnt/tmpfs tmpfs nodev,nosuid,noexec,nodiratime,uid=50,gid=50,size=16M 0 0

## Setup ramfs

First create the directory you will use# mkdir -p /mnt/ramfsThen mount it as ramfs (I'm using here 16M)# mount -t ramfs -o size=16m ramfs /mnt/ramfsYou can check that it's mounted correctly# mount  
ramfs on /mnt/ramfs type ramfs (rw,size=16m)  
You can also make it automatically mounted by adding this line in your *fstab* configuration file:ramfs /mnt/ramfs ramfs nodev,nosuid,noexec,nodiratime,uid=50,gid=50,size=16M 0 0