Move Chrome’s Cache To RAM (Guide For Linux Users)
Browsers will keep ‘pieces’ of a webpage in what’s called a cache. This cache allows them to quickly pull files from the disk (which is quite somewhat quick) instead of having to redownload them (which is slow). Your system’s RAM is even faster than your disk, hundreds of times so, and keeping a file in RAM means accessing it will be nearly instant. Browsers are going to load up these files to RAM regardless but we can speed up writes to the cache and improve privacy by having the entire cache kept in RAM from the beginning. To do so we’ll be creating a RAM disk and then telling Chrome to use it.
Remember, your cache is deleted every time you shut down your computer if you follow this guide. It will get rebuilt the next session.
First off we’re going to create a directory in /tmp/ , which we’ll call ccache.
mkdir /tmp/ccache
Then we need to open up /etc/rc.local. The commands in /etc/rc.local are run whenever the system starts up. Enter the following line, which tells the system to mount the RAM disk at /tmp/ccache/. You’ll see size=700M. Keep in mind that this is in Bytes and it’s how much RAM you’re allocating to the new filesystem. You can change that size to whatever you want but I don’t think anyone’s going to be using much more than 300MB, but I keep some extra room in there.
mount -t tmpfs -o size=700M,mode=0744 tmpfs /tmp/ccache/
We now set the permissions on /tmp/ccache (recursively) to 777. For some reason 777 is all that’ll work for me.
chmod 777 /tmp/ccache/ -R
Now that’s all set up we need to create a Chrome desktop shortcut. However your distro lets you do that, just drag it wherever. Right click it, properties, and add the following (word press messes up double -‘s. You’ll have to type those out).
–disk-cache-dir=”/tmp/ccache/” –disk-cache-size=600000000
Now when you launch Chrome from that shortcut it’ll use the disk cache we’ve set up.
Now, in terms of privacy what we’ve done is eliminated the ability for an attacker with access to your system to view your cache/ try to see what you’ve been up to except for that session. Every time you shut your system down you lose the cache, as such no one can see where you’ve been.
If you were on some dodgy site or doing something sensitive or whatever all you have to do is restart the system and there will be no trace left (in the cache at least).
It may or may not be worth the trouble to you. Since Chrome’s already mapping this stuff to RAM anyways you shouldn’t expect any major performance improvements. But those who fear micro-writes to their SSD can use this to prevent wear/tear.
blog comments powered by Disqus