How to create a ramdisk?

black and gray computer motherboard
Photo by Valentine Tanasovich on

Whether you have SSD with NVME Protocol or good old HDD, It is not going to make you feel superior than your Random Access Memory or RAM.

By creating a ramdisk, you can use your unused memory as a super fast disk space and work with it. I do need to use nginx and for caching, I always go to tmpfs which is filesystem type that typically uses ram. How do I create one?

Processes are –

sudo mkdir /tmp/myramdisk
sudo chmod 777 /tmp/myramdisk

Fstab entry –

myramdisk  /tmp/myramdisk  tmpfs  defaults,size=1G,x-gvfs-show  0  0

Now, every boot, there will be a ramdisk named myramdisk for you. By the way, mount with mount -a

Thank you for reading this. This is kind of a journal.