Getting rid of browser cache polution

Print Friendly, PDF & Email

I always try to keep a clean slate on my Linux box. Not only when it comes to security but one thing I really hate is the massive amount of stuff that gets downloaded as “chemical waste by-products” like a gazilion revisions of twitter and other (anti-)social media icons, pictures, style-sheets etc. etc. etc.

Obviously you can set limitations to the size of the cache but to prevent this pollution from being retained across reboots and clogging up the inode tables with useless entries.

old_hard_drive_products_pdc6c

Since I use Firefox on Fedora this is pretty simple to resolve. First, since Fedora 18 it uses a RAM disk as temp space via the tmpfs filesystem which is mounted on /tmp. This means that when the system reboots everything sitting on here will be scrapped during a reboot.

Issue the “mount” command you’ll see an entry like:

debugfs on /sys/kernel/debug type debugfs (rw,relatime)
tmpfs on /tmp type tmpfs (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw,relatime)

By adding a Firefox directive in the “about:config” you can direct the browser to use that space.

Open a tab and type “about:config” in the address bar. Select “I promise” when getting warned about all hell and doomed events that can happen to you when you screw up. Add the following string by right-clicking > New > String >




 

browser.cache.disk.parent_directory

Add “/tmp” as value and restart the browser.

When you now start using the web there will be a “/tmp/cache2” directory where Firefox dumps all the stuff you’ll never need again.

To check on the usage and if Firefox really does put it’s stuff there including how much you can use the “about:cache” page to verify how things stand.

Selection__104_1

Two positive side-effects are that Firefox will be somewhat faster when you use a spinning disk on you $HOME (where normally your cache is located) or it reduced I/O cycles on a flash-drive which can improve the lifetime of your flash drive. (Maybe not very much but, hey, everything helps.)

Regards,

Erwin

 

About Erwin van Londen

Master Technical Analyst at Hitachi Data Systems
Linux , , ,

Comments are closed.