Posts Tagged ‘firefox’
Ramdisks, Firefox, and the speeding up thereof
So this idea has been going around the internet, of putting your firefox profile directory into tmpfs, to get around sqlite’s insistence on reliability when speed is more important.
I implemented this, and liked it. Speed, nom.
But! I happen to be using an ailing old laptop, with roughly as much RAM as a toaster. It could just handle the extra load, but the profile directory was constantly spewing expletives at me – most notably, failing silently when trying to install addons.
There did exist RamFS, which grew and shrunk in RAM as needed. Still, that’s a lot of memory…
And, well, the idea itself didn’t seem that elegant to me. Storing an extra copy of your profile directory? and resynchronising it with the harddisk copy every so often? This is Linux, after all, the OS that gives you fine-grained control of your system should you so desire – surely there must be a cleaner way.
And then … from what I understood, SQLite was IO bound in writes. Reads shouldn’t really need locks or suchlike, right?
This is what I did:
$ x=[random junk firefox uses]
pushd
cd ~/.mozilla/firefox
mv $x.default $x.default.fs
mkdir $x.default.tmp
mkdir $x.default
echo firefox.tmp $(pwd)/$x.default.tmp ramfs noauto,user,exec 0 0 | sudo tee \
-a /etc/fstab
echo firefox.cow $(pwd)/$x.default aufs \
dirs=$(pwd)/$x.default.tmp:$(pwd)/$x.default.fs=ro,noauto,user,exec 0 0 | sudo \
tee -a /etc/fstab
sudo sed -i 's/exit 0//' /etc/rc.local
echo "mount firefox.tmp\nmount firefox.cow\nchown -R $(whoami): \
$(pwd)/$x.default.tmp\nexit 0" | sudo tee -a /etc/rc.local
echo rsync -av --delete $(pwd)/$x.default/ $(pwd)/$x.default.fs/ > ~/bin/cpfox
chmod +x ~/bin/cpfox
popd
Then crontab -e and add cpfox to it, maybe once every halfhour.
Neat, huh? At least the intent – aufs layering a dynamically growing ramfs on the filesystem, and the changes being synced across every so often. I’m not too sure if the actual implementation does what I want it to, and it could probably do with a ram-clear every now and then.
If anyone has any tips, please! Meanwhile, I hope this will help some people out there.



