Super Simple Linux RAM Disk Manager – rdmanage

I’m currently developing a piece of server software which needs to be able to create, modify, serve up and dispose of many temporary files many times every second. Because a great number of I/O operations will be occurring, the program requires very rapid disk access – ideally, it would run on a RAID array or a solid-state disk. Because the server I’m using doesn’t have either, I’m using RAM disks as a substitute.

RAM disks take a portion of your system RAM memory and make it available for storage by mounting it in your file system. Using a RAM disk, you gain a working folder with speed way far in excess of any hard disk or even solid state drive. The usual rules of RAM apply – this is volatile memory, so anything stored on a RAM disk will be erased when the power is cut – but it’s perfect for temporary file storage.

I’ve written a very simple program for Linux called ‘rdmanage’ to help create and manage RAM disks easily at the command line.


There are three modes of operation for this program – create a new RAM disk, create a RAM disk from an existing folder, and remove existing RAM disk. As promised, the program is very simple to operate:

To create a RAM Disk:

$ ./rdmanage create [size in mb]

For example, to create a 100MB RAM disk:

$ ./rdmanage create 100

To create RAM Disk from an existing folder:

$ ./rdmanage from /path/to/folder

For example, to create a RAM disk from the folder ‘/home/randymarsh/sim’:

$ ./rdmanage from /home/randymarsh/sim

To remove an existing RAM Disk:

$ ./rdmanage remove


– When using the ‘from folder’ mode, the maximum size of the folder is 512MB

– You will need root permissions to mount the RAM drive

– The ‘remove’ mode will commit the state of the RAM drive to disk in a folder called ‘ramdisk.contents’

– All operations will occur within the current working directory (i.e. the folder you’re presently in). To check which folder you’re in, type ‘pwd’ at the command prompt.

– Depending on how you download the program, you might have to set the file as executable:

$ chmod +x rdmanage

– If you want to check the status of your drive, it will be listed when you use the ‘df’ command

– For program help, type:

$ ./rdmanage help


You can download the program by right-clicking here and selecting ‘Save As’/’Save Target As’, or if you would prefer to download straight to your Linux machine from the command line, use wget:

$ wget

Hopefully this program can save you a bit of time creating and managing your RAM disks. Enjoy!

8 Responses to “Super Simple Linux RAM Disk Manager – rdmanage”

  1. Emil says:

    What purpose does this serve? Not being sarcastic. Genuinely interested.

    • Zebedee Pedersen says:

      You grab a section of your RAM (now that we’ve all got 4GB+ it’s feasible to take a few hundred meg) and mount it as a virtual disk – basically if you create a 500MB RAM disk, you can copy up to 500MB of stuff into it and you can read and write from it an order of magnitude faster than a hard drive or even an SSD.

      I think there’s a post appearing tomorrow (possibly today?) benchmarking the RAM disks, SSDs and hard drives I have dotted about my desk, it’s kinda interesting. I’m sure there’s tools out there for PC, but I’ve written two versions of ‘rdmanage’ for Linux and Mac OS X to automate some of the Terminal rigmarole necessary.

      As far as usage goes, I’m using a 200MB RAM drive on my server which is used to store data for an iPhone app I’m writing at the moment. Because there’s no limit to the number of iPhones/iPads/Android/Macs that could, potentially, be reading and writing the files at the same time, I needed much more IOPS (I/O Operations per Second) than the hard drive in my server could offer, and IOPS is one area where RAM absolutely destroys a spinning hard drive.

      • J. Cobb says:

        Thanks much for your script. I’ve been playing Morrowind in WINE on Linux. There’s an annoying delay loading music files for different scenarios (some WINE bug).

        Creating a ramdisk, moving the music files to it and creating a directory link to the ramdisk shortens the delay considerably.

        Since my computer is a low-end system with limited memory I didn’t want to set a kernel option that reserves memory for a ramdisk. I wanted to create and remove it on the fly whenever I play the game. So the memory is available to other programs.

        Your script lets me do that.

        Thanks much!

  2. […] couple of days ago I posted a small program that I created to facilitate easy creation and management of RAM disks on a Linux […]

  3. Plan9 says:

    I don’t mean to put a dampener on your contribution, but the code is a little odd. Really this should have been a straight up shell script or you should have used Pythons libraries for everything. The way you’ve written it is some weird halfway house that adds unnecessary overhead, dependencies and complexity.

    Also, you should have inherited the parent folder permissions rather than using chmod 777 (insecure).

    And finally, you script should include a disclaimer that any contents held on the RAM disk is volatile and changes will be lost (else write daemon to sync your data against a persistent copy)

Leave a Reply