Nikos Roussos

I've posted before about this little hack on speeding up firefox. The key is that you actually move the entire .mozilla folder from disk to memory. First you have to mount /tmp to memory (some linux distributions may do this by default) adding this line to /etc/fstab and rebooting:

none /tmp tmpfs size=512M,nr_inodes=200k,mode=01777 0 0

Then it's safe to do:

cp -R /home/user/.mozilla /home/user/.mozilla_save
mv /home/user/.mozilla /tmp/mozilla
ln -s /tmp/mozilla /home/user/.mozilla

I updated the script so I can use it as a system init script:


start() {
    mkdir -p /tmp/mozilla
    rsync -avi --delete /home/user/.mozilla_save/ /home/user/.mozilla/

stop() {
    size=`du -xs /home/user/.mozilla/ | awk '{print $1}'`
    digits=`expr length $size`
    if [ $digits -gt 4 ]; then
        rsync -avi --delete /home/user/.mozilla/ /home/user/.mozilla_save/
        echo 'no!'
        exit 0

case "$1" in
     echo $"Usage: $0 {start|stop}"
     exit 1;;

So I placed this script at /etc/init.d/, made it executable and created a link inside /etc/rc.5/

ln -s /etc/init.d/ /etc/rc5.d/S99ffsync

rc5 because the default runlevel on Fedora is 5. You can see yours from /etc/inittab. So every time my system boots the above script runs with the start option (executing the start function) and every time it halts/reboots it runs with the stop option (stop function). In order to be sure that no data loss will occur in the unlikely event of sudden shutdown, I have a cronjob that saves the mozilla folder every 15 minutes.

*/15 * * * * /etc/init.d/ stop

Trust me. With the above hack you'll see a significant difference on firefox's speed. Especially if you're you using firefox's awesome address bar to search through your browser's history.