Adding a RAM Disk to Linux Hosts

Want to add a “RAM disk” to your Red Hat Enterprise Linux host? If you mean an all-RAM filesystem then it’s super easy. Add this one line to your /etc/fstab:

none /ramdisk tmpfs defaults,size=1024m 1 2

(tabs between the fields, like everything else in fstab)

Then a “mount -a” will get it running. Obviously change size=1024m to be whatever makes sense.

Probably works great on other distributions, too, just haven’t tried it.

2 thoughts on “Adding a RAM Disk to Linux Hosts”

  1. Hi Bob,

    Thank you very much for this tip! It works on SLES 9, I am currently optimizing a 70GB table in a Postgres database and I was able to double the speed of the process by putting journal files on a ram disk. Now it will only take about 15 hours instead of 30.

    Denis

  2. It should be noted that you’re not setting up an actual RAMdisk – you’re using tmpfs, which also makes use of SWAP.

Comments are closed.