Linux has the native ability to support two filesystem types that allow for RAM-based storage: ramfs and tmpfs. A RAM disk can give faster-than-SSD read and write speeds ideally suited for applications that rely heavily on cached data.

The key difference between ramfs and tmpfs is that ramfs does not take a maximum capacity, which could potentially give us problems, so we will be looking at tmpfs. The volatile nature of random access memory makes this configuration a no-go for storing anything important and you should keep in mind that that all data will be lost in a reboot or if the device is unmounted.

Get an idea of your current RAM usage by using the free -h command. First we will make a mount point for our file system, we’ll go with /mnt/ramdisk. The next command will mount a 1 GB EXT4 filesystem to /mnt/ramdisk; however, the amount you choose should be appropriate to your system and hardware.

mkdir /mnt/ramdisk

mount t tmpfs o size=1024m ext4 /mnt/ramdisk

Since this will disappear after every reboot we can add the same mount command to our /etc/rc.local file to have it created on boot.