logo

simple guide to creating a RAM disk

logo

I had a thought of using a RAM disk as a message queue for a messaging application I am working on, as opposed to creating a table in a database, or using a regular flat text file. Every time I need a message to be sent, I’ll add a text file on the RAM disk, then the sending process can scan for files. All of this is happening in RAM, so it won’t be thrashing the disk!

Here is a guide I found which was very straightforward. I got the disk set up in a few minutes.
http://www.vanemery.com/Linux/Ramdisk/ramdisk.html

I didn’t bother changing the size of my disks, and it turns out they defaulted to 16mb anyway.

This can be added to a shell script and set to run on startup by calling it in /etc/rc.local

/sbin/mke2fs -q -m 0 /dev/ram0
/bin/mount /dev/ram0 /mnt/rd
/bin/chown van:root /mnt/rd
/bin/chmod 0750 /mnt/rd

One Response to “simple guide to creating a RAM disk”

  1. Nick Mudge says:

    Cool. I didn’t know about ramdisks before. I looked at the how-to. It’s good to know about this.

logo
logo
Powered by WordPress | Designed by Elegant Themes