Smoothwall Firewall project

Thursday 11 November 2010

Speeding up your Linux browser using a ramdisk

I came across an interesting article yesterday, about someone who had speeded up their browser on Windows by using a ramdisk, and knowing that Linux can happily do this, I decided to write down how to do this for the Linux user.

Firstly we need to create a directory that we can use for the ramdisk, and get it to automatically mount everytime we start our machine.

1) create the directoty - sudo mkdir /var/ramdisk
2) then edit this file and add the following line at the end - gksudo gedit /etc/fstab
/var/ramdisk /var/ramdisk tmpfs size=512m 0 0
3) Now mount this new ramdisk to test
sudo mount /var/ramdisk

We now have our ramdisk, and we can add this to the start options for Chromium and Firefox.

Firstly we will do Chrome as it's the easiest, simple add the following line to the startup options/icon that your use to start Chrome.


See below:

If you now click on Chrome, you will now be using a Ram disk, and you can look at what you are storing in that cache, but looking in the directory you created earlier.

Now, for firefox we use a different method,

Mozilla Firefox

  • Type about:config into the address bar, accept the warning ("I'll be careful, I promise!")
  • Right click > New > String
  • Type browser.cache.disk.parent_directory into the box and press OK
  • Type the path of your BrowserCache directory -- /var/ramdisk press OK
  • Close all open Firefox tabs and windows
  • Open the browser again
(Part of the above section was lifted directly from this web page to save typing -

That's it, you now have you cache being stored in RAM instead of on disk, which is significantly faster, for saving and reading cached pages. I have started with a RAM disk of 512m, which may be too large for you or too small, but you can adjust that once you see what your usage profile is like.


Unknown said...

Why not just use /dev/shm?

Bob Toovey said...

Nice post but this tweek would only be suitable for machines with losts of real memory I guess.

I have a question though, as fstab has been modified will the ramdisk be available after each reboot?

A reboot is needed to enable the ramdisk but will the new 'drive' automount so that is it always available?

Cheers - bob