Setup a fast RAM drive in minutes!
What Is aRAM Drive?
The RAM chips in your gear can be used to hold a virtual drive.
This drive is then not stored on the hard disk but in RAM.
Sounds too good to be true?
RAM storage is considered volatile.
In other words, RAM drives lend themselves to temporary applications or to specific optimizations.
Another system is pre-loading often accessed data into a RAM drive.
A RAM drive furthermore does not work the same as tmpfs allocation/instance.
Shutterstock/ Suncheli Project
And, if it goes to disk, it will be slower.
Creating aRAM Drive
Creating a RAM drive is relatively straightforward.
If the same is not found, then we proceed with three sudo commands.
All three requiresudo, though for various reasons.
We set the size to 1GB by usingsize=1g.
This is a handy/quick verification that the script was successful when executed.
Our secondary script,umount_ram.sh, unmounts the RAM-based drive with mount point/mnt/ram, i.e.
the ramfs drive we just created.
We then created a 1GB ramfs drive under/mnt/ramusing a small script to mount or RAM drive.