Tmpfs

From Ubuntuwiki.net

Jump to: navigation, search

tmpfs is a volatile filesystem (does not persist across reboots) which stores files in RAM if available, in virtual memory (swap partition or file) if not.

To mount /tmp as tmpfs with a maximum size of 1GB, rather than having it just be a random directory on your / partition, add this line to /etc/fstab:

tmpfs /tmp tmpfs defaults,noatime,mode=1777,size=1G 0 0

You'll need to reboot in order to make the change happen - on a lightly loaded system, you may be tempted to simply delete everything currently in /tmp and then issue a mount /tmp... but I wouldn't recommend it. You might get away with it on a headless box, but anything running X is probably going to exhibit a lot of odd inexplicable behavior afterward until you give up and reboot anyway.

If you use Firefox, you may also want to visit about:config, add a new key named browser.cache.disk.parent_directory, and set it to /tmp - this will use your new tmpfs for a semi-persistent cache that survives opening and closing the browser, but goes away upon reboot. Or, you might instead choose to set browser.cache.disk.enable to false - there's still a memory cache enabled, so if you don't completely close Firefox often this will probably suffice.

Personal tools