Firefox and Chrome Cache on RAM Drive – Fedora and Ubuntu

0
2

By storing browser cache to ram disk, you can improve browsing speed. Especially if you are surfing all day. Now a days modern computers are equipped with more than required ram. Part of this RAM can be used for caching purpose. Also this will spare you from cleaning disk clutter.

By default RAM drive size may / may not be enough. Increase it to 512Mb or whatever size you wish to allot for caching. Use following method to change default ram_size.

Here for example, we are increasing ram_size to 512mb

On Fedora System.

su

vi /boot/grub/grub.conf

#append ramdisk_ at the end of kernel parameter.

#e.g

#Before change

kernel /vmlinuz-2.6.35.10-74.fc14.i686 ro root=UUID=dbea17b6-292a-435e-a4d7-d202b772e6aa rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us quiet

#After change

kernel /vmlinuz-2.6.35.10-74.fc14.i686 ro root=UUID=dbea17b6-292a-435e-a4d7-d202b772e6aa rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us ramdisk_ quiet

On Ubuntu System (UPDATE- 10.10 & above).

su

vi /boot/grub/grub.cfg

#append ramdisk_ at the end of linux parameter.

#e.g

#Before change

linux /boot/vmlinuz-2.6.35-22-generic root=UUID=a54a4a62-f264-4c04-a86f-83addaad2e55 ro quiet splash

#After change

lnux /boot/vmlinuz-2.6.35-22-generic root=UUID=a54a4a62-f264-4c04-a86f-83addaad2e55 ro ramdisk_ quiet splash

UPDATE-

For Ubuntu 10.04 use /boot/grub/menu.lst

Also If content above mentioned rc.local does not work use following.

#!/bin/sh -e

if [! -e /tmp/ram ]; then

mkdir /tmp/ram

fi

mke2fs -q -m 0 /dev/ram0

mount /dev/ram0 /tmp/ram/

chmod 777 /tmp/ram/ -R

exit 0

REBOOT YOUR SYSTEM TO LET CHANGE TAKE EFFECT.

As root user, Mount RAM drive as /tmp/ram. Following commands you can save in /etc/rc.local to get executed at every boot.

mkdir /tmp/ram

mke2fs -m 0 /dev/ram0

mount /dev/ram0 /tmp/ram/

chmod 777 /tmp/ram/ -R

UPDATE-

OR you may use tmpfs, which is convenient

mount -t tmpfs -o tmpfs /tmp/ram1/

chmod 777 /tmp/ram/ -R

Change browser caching location.

Firefox

type about:config in address bar, search for browser.cache.disk.parent_directory. change its location to /tmp/ram/firefox or any other directory if you are going to save Chrome cache on same ram drive. This will help you identify each cache. By default firefox stores cache in cacheme whereas chrome in Cache folder.

Restart firefox, you’ll find new folder in /tmp/ram

Chrome

For chrome its extremely easy. append -disk-cache-dir=”/tmp/ram/” in launcher

e.g

/opt/google/chrome/google-chrome –disk-cache-dir=”/tmp/ram/”

This is all you need, now onwards on every reboot / boot of your computer, ram drive will be created as /tmp/ram. And chrome / firefox will create cache dir.

Change of cache path, does not affect bookmarks, its all stored in $USER folder.

Thanks for the comments. Its improved post.

Source

Leave a Reply