Create a small RAM disk for ultra fast I/O

In this simple guide I will explain how to create a virtual ram disk based on ext3 file system to be used for very fast I/O.

This example is very useful though it has important limitations, for example:

  • It does not allow big ram drives, as far as I know, the limit is 64 MB
  • Whatever is stored in the ram drive, is destroyed as soon as your system is restarted

In this example, we create a ram drive of 64 MB, we mount and set permissions so that your current user is the owner of the newly created file system.

Step 1: create the new file system, based on memory:

sudo mkfs -t ext3 -q /dev/ram1 65536

As you can see, the disk size is 64 MB, we use as device the /dev/ram1 (you can use by default up to ram15) and the file system used is ext3.

Step 2: Create the directory to be used to mount the new file system

sudo mkdir -p /ramdrive

Step3: Mount the file system

sudo mount /dev/ram1 /ramdrive -o defaults,rw

Step4: take the ownership of the new file system

sudo chown [USERNAME] /ramdrive -R

Replace the [USERNAME] part with your actual user name…..if you don’t know who you are, try to check it with the whoami command.

This article, very simple, has a lot of limitations due to the small size of the disks you can create.
Planning to write an article on how to create bigger volumes with  tmpfs.

Side Note: Nowadays, using a 64bit OS, having a lot of RAM on your PC allows you to create quite big ram drives having incredible performances during read/write operations, sometimes it is useful to leverage on this to have ultra fast user experience.

Leave a comment