Jan 252011

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


VN:F [1.9.22_1171]
Rating: 9.0/10 (1 vote cast)
Usage of a Ramdisk on Linux, 9.0 out of 10 based on 1 rating

Related Posts:

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>