| Sunday December 21st 2014

Feedburner

Subscribe by email:

We promise not to spam/sell you.


Search Amazon deals:

HOWTO: Move your logs and temp files to RAM


While working with netbooks and other portable computers over the years I have always looked for new ways to improve battery life, Juelz Venturabut I have also been concerned with maximizing performance of these small systems. Today I would like to share with you a simple trick to improve performance and the overall “feel” of your computer.

To improve performance while also improving battery life we will be moving all of your temp files and logs to RAM. This significantly reduces IO from some applications (e.g., Firefox/Flash) while eliminating the need to wake your hard drive from a sleep state (think battery life).


First, edit your /etc/fstab and add the following lines:

tmpfs /tmp     tmpfs defaults,noatime,mode=1777 0 0
tmpfs /var/log tmpfs defaults,noatime,mode=1777 0 0
tmpfs /var/tmp tmpfs defaults,noatime,mode=1777 0 0

Next, lets stop the syslog services and clean out your current temp and log directories. We’ll also mount the new RAM disks and restart the syslog service. Note: the name of the syslog service will change from distribution to distribution.

# /etc/init.d/sysklogd stop
# rm -rf /tmp/*
# rm -rf /var/log/*
# rm -rf /var/tmp/*
# mount -a
# /etc/init.d/sysklogd start

Please note that moving these logs and temp directories to memory will cause the contents to be lost when you restart. If there is a need to save these logs to disk before restarting, manually copy them to another directory before you reboot.

rsync -av /var/log/* ~/saved_logfiles

Now that you have moved your temporary directories and logs to RAM, lets tweak Firefox. Open Firefox, and in the address bar type “about:config”. Click through the warning message. Right click anywhere in the parameter listing and select New -> String. Set the preference name to ‘browser.cache.disk.parent_directory’ (without the ticks) and set the value to ‘/tmp’ (without the ticks).

Restart Firefox. You should find that Firefox is a little “snappier”, and sites that use flash like Hulu may even work a little better. Additionally, if you are on battery and using a utility like Jupiter that manages your laptop modes you should see an increase in battery life.

Related Posts: On this day...

Leave a Reply

You must be logged in to post a comment.