Tweaks to improve laptop performance

Discussion in 'Linux' started by dragonbite, Aug 1, 2010.

  1. dragonbite

    dragonbite Well-Known Member

    Joined:
    Aug 30, 2008
    Messages:
    477
    Likes Received:
    3
    It works with desktops too, though you won't notice any battery improvements ;)

    The idea is to improve performance while also improving battery life we will be moving all of your temp files and logs to RAM. This greatly reduces the I/O on the hard drive and everything running physically (hard drive, optical disks, etc.) sucks up way more battery juice than software.

    The down-side of this is whenever the system is shut down, the log files are lost. You should be able to access and copy (rsync) the contents as you would any other directory, but when the system is shut down they're gone!

    1. Edit /etc/fstab to repoint LOG and TEMP folders to RAM adding the following code to /etc/fstab
      Code:
      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
    2. Optionally, can copy the current contents of the log files, although if you don't want them you can skip this step
      Code:
      rsync -av /var/log/* ~/saved_logfiles
    3. Stop the syslog service and clean out their current contents. Note, for Fedora use rsyslog instead of sysklogd and openSUSE use syslog.
      Code:
      sudo /etc/init.d/sysklogd stop
      sudo rm -rf /tmp/*
      sudo rm -rf /var/log/*
      sudo rm -rf /var/tmp/*
    4. Now mount the RAM disk and restart the syslog service. Starting the syslog service may vary from distro to distro
      Code:
      sudo mount -a
      sudo /etc/init.d/sysklogd start
    5. Now can tweak Firefox
      1. put about:config in the URL and click through warning messages
      2. Right-click in the parameters listing and select New > String
      3. Set preference name to browser.cache.disk.parent_directory and the value to /tmp
      4. Restart firefox

    This information is pulled from the blog post Move your logs and temp files to RAM and watch your portable fly!.
     
  2. snh

    snh Well-Known Member
    Director

    Joined:
    Oct 6, 2008
    Messages:
    137
    Likes Received:
    0
    Nice tip. Thanks!
     
  3. dragonbite

    dragonbite Well-Known Member

    Joined:
    Aug 30, 2008
    Messages:
    477
    Likes Received:
    3
    An Update:

    Usually I do not turn on my laptop during the general meetings until the speaker is starting (I use it to type/keep notes) and often the battery life is racing against the speaker's endurance.

    This time, though, after having applied this tweak I found the laptop's battery to last significantly longer. Long enough that I still had 20 minutes +/- when I booted up at home before plugging it in!

    So now the laptop has improved from a little over an hour (like 1:15 or 1:20 if I am good), to closer to 1:40 with wireless on! I know it's a far cry from some systems out now but it is definitely an improvement!

    The only other tweak I can think of to improve it more would be to replace the hard drive with an SSD. I have not seen any indication there is a larger battery available for the system.

    I will also attest that, as the article noted, Firefox is slightly snappier once it is up and running. It is not a huge difference, but does seem slightly better.
     
  4. dragonbite

    dragonbite Well-Known Member

    Joined:
    Aug 30, 2008
    Messages:
    477
    Likes Received:
    3
    Actually, after performing this on Ubuntu, I ran across a couple things to keep in mind.

    1. Ubuntu uses rsyslog
    2. When running apt-get to update the system it will pull up the following error
      Code:
      E: Directory '/var/log/apt/' missing
      E: Directory '/var/log/apt/' missing
      
      so it is probably best to add this directory to the tmpfs lines in /etc/fstab
      Code:
      tmpfs /var/log/apt     tmpfs defaults,noatime,mode=1777 0 0

    Otherwise, I am noticing an improvement with the battery life by performing this in Ubuntu, Fedora and openSUSE.
     

Share This Page