Usage of a Ramdisk on Linux

The older approach involves the creation of an ext3 filesystem on /dev/ram0 (a part of the RAM):

sudo mke2fs -t ext3 -m 0 -q /dev/ram0
sudo mkdir -p /media/ram0
sudo mount /dev/ram0 /media/ram0
sudo chown USERNAME /media/ram0
sudo chmod u+rwx /media/ram0

The newer and easier method to create a ramdisk is to make use of the tmpfs system shipped with the Linux kernel. On Ubuntu there is usually already a tmpfs ramdisk mounted at /dev/shm but if you want to mount one more you can do that using:

mkdir /tmp/ramdisk; chmod 777 /tmp/ramdisk
sudo mount -t tmpfs -o size=256M tmpfs /tmp/ramdisk/

It will create a 256MiB tmpfs ramdisk in /tmp/ramdisk. If you want a 1GiB ramdisk with 10240 inodes, only accessible by the owner of /tmp/ramdisk2 mount instead using:

sudo mount -t tmpfs -o size=1G,nr_inodes=10k,mode=0700 tmpfs /tmp/ramdisk2