How to use a Ramdisk in Linux

Ramdisk is a feature in Linux which lets us use a RAM device as if it were a storage media. A RAM disk has a fixed size and behaves like just another disk partition with exceptionally fast speed. As the disk is physically located on the RAM, it’s access time is as fast as that of the RAM.

With a RAM disk, we can keep temporary data needing fast calculations and access in the RAM. This may include caches, compressed files and encrypted files. Using the RAM disk as a web cache can speed up browsing considerably. It can also be used to load guest operating systems for faster virtualization.

The only disadvantage of using a RAM disk is that you will lose all data in case of a power failure. But, this comes as an advantage in case when you are browsing through the Internet and using the RAM disk to store the cache or when you are using RAM disk to deal with encrypted files. In both the cases, the data is lost without a trace and desirably.

Support for creating RAM disks has been present in Linux from the Kernel Version 2.4.

To create and use a RAM disk, you can see the step by step guide to creating a RAM disk .

This tutorial is for Red Hat which has a number of built in RAM disks. For other distros of Linux, based on the kernel 2.4 and above, the tutorial should work equally fine.

Published by

Chinmoy Kanjilal

Chinmoy Kanjilal is a FOSS enthusiast and evangelist. He is passionate about Android. Security exploits turn him on and he loves to tinker with computer networks. You can connect with him on Twitter @ckandroid.