Put your Firefox cache onto a ram disk.

Soldato
Joined
9 Dec 2003
Posts
3,585
Location
UK
Something for you to try if you haven't already.

Benefits: Speed , security and saves power.
Drawbacks: Cache is repopulated from scratch after a reboot.

Doing it manually:
sudo mkdir /mnt/ramdisk
sudo mount -t tmpfs -o size=80M,nr_inodes=10k,mode=777 tmpfs /mnt/ramdisk
size 80M, permissions=777

In Firefox, set the cache location to your new ramdisk:

Open about:config and add a new entry of type string.
name: browser.cache.disk.parent_directory
value: /mnt/ramdisk/

Close and re-open Firefox. Browse to a site and check /mnt/ramdisk/ is populated with files. Go into your home folder. Find and delete your old cache directory. Job done.

To automount the ramdisk and browse this way from now on you need to edit your fstab file.
gksudo gedit /etc/fstab

Add:
#firefox cache
tmpfs /mnt/ramdisk tmpfs size=80M,nr_inodes=10k,mode=777 0 0
 
Soldato
OP
Joined
9 Dec 2003
Posts
3,585
Location
UK
Moved on from this and currently testing running my whole profile from ram.

The lack of a decent way to run a script on shutdown, as a normal user, is something I need to find out.
 
Soldato
Joined
18 Oct 2002
Posts
7,139
Location
Ironing
Moved on from this and currently testing running my whole profile from ram.

The lack of a decent way to run a script on shutdown, as a normal user, is something I need to find out.

I run my firefox profile from RAM on my eee. Wrote a script which creates the ramdisk, rsyncs the profile to it, loads firefox which thinks the profile is on the ramdisk location (/mnt/memdisk/), and then rsyncs the contents back to storage when the firefox process quits. I'll dig it out when I get home.
 
Soldato
Joined
18 Oct 2002
Posts
7,139
Location
Ironing
sounds interesting, would like to see that script!

I'm still at work, but in pseudocode:

Code:
#!/bin/bash
mount tmpfs /memdisk tmpfs -o size=40m 
mkdir /memdisk/.mozilla/
rsync -R /home/growse/.mozilla/* /memdisk/.mozilla/
firefox
rsync -R /memdisk/.mozilla/* /home/growse/.mozilla/

As long as firefox thinks it's profile is always in /memdisk/.mozilla/, there's no problem. Takes a little longer to start ff, and you've got to wait while the disk thrashes after you've quit it before you start it again, but I think that's about right.

Oh, and suggested improvements welcome.
 
Soldato
OP
Joined
9 Dec 2003
Posts
3,585
Location
UK
Well see I was looking for a decent way to save the profile on shutdown.
Saving on firefox close and even logout is easy enough but not shutdown. Unless you run a system wide init which I don't want to do. It's just something to fiddle with anyway :)

I mount the profile folder normally. Stumbled across the idea when browsing the Gentoo forums.
The thread is here http://forums.gentoo.org/viewtopic-t-717117.html

If you've been using the ramdisk trick the speed gain isn't that great. If you've gone from normal setup to ram profile it's quite a laugh.

Syncing saved data is always the awkward thing with ramdisks.
 
Back
Top Bottom