Categorized | Linux, Networking, Security, Ubuntu

Ultimate UBUNTU Linux Optimization and Tweak Guide

Posted on 02 May 2007 by admin

WebWatcher-Get 40% Off

Everyone keeps talking about Ubuntu these days.  Even my grandmother mentioned it to me.  The talk is ease of use, but not that much on tweaking performance.  That’s why I decided to compile the master list.  Here is the Ultimate UBUNTU Optimization Guide.   It will take less than a half hour to perform all these tweaks. These tweaks will make your system faster, more responsive and will improve your overall UBUNTing experience.

These tweaks should work with all flavours of Linux. I have only tried them on Ubuntu  so if you port them to other flavours, do so with CAUTION! These have been compiled from a million different sources so I don’t know who to credit with them, if you do, pat them on the back for me!

Speed up your File System

The default Ubuntu FileSystem (FS) is EXT3 unless you changed it. There are 3 journaling methods for EXT3 system.

  • Journal Data Writeback
  • Journal Data Ordered
  • Journal Data

The Ubuntu default is "journal data ordered". In data=ordered mode, ext3 only officially journals metadata, but it logically groups metadata and data blocks into a single unit called a transaction. When it’s time to write the new metadata out to disk, the associated data blocks are written first. data=ordered mode effectively solves the corruption problem found in data=writeback mode and most other journaled filesystems, and it does so without requiring full data journaling. In general, data=ordered ext3 filesystems perform slightly slower than data=writeback filesystems, but significantly faster than their full data journaling counterparts.

To speed it up, we are going to change it to the data=writeback system.

  • Open your Grub boot menu.

sudo nano -w /boot/grub/menu.lst

  • Look for the Defoptions and Altoptions and make them look like the entry below.

# defoptions=quiet splash rootflags=data=writeback
# altoptions=(recovery mode) single rootflags=data=writeback

  • You need to update your Grub since you have altered it.

sudo update-grub

  • Now we are going to edit the Fstab because it will be expecting these options.

sudo nano -w /etc/fstab

  • Now you are going to want to add the (data=writeback and noatime=0) flags to your hard drive. It might be a little confusing because of the new naming system. Look for the (,errors=remount-ro) and add it afterwards to make it look like our example.

defaults, errors =remount-ro,data=writeback,noatime 0

  • Now you tell your system to use them both.

sudo tune2fs -o journal_data_writeback /dev/yourdrive

Concurrent Booting

Concurrent booting allows Ubuntu to take advantage of dual-core processors, as well as processors that hyperthread or multithread.   By default Ubuntu does not support multiple processors or dual-core processors.

  • These settings are located in your /etc/init.d/rc file.

sudo gedit /etc/init.d/rc

  • Look through the file and you will find CONCURRENCY=none. You want to change it to:

CONCURRENCY=shell

Swapping/Swappiness

Swappiness takes a value between 0 and 100 to change the balance between swapping applications and freeing cache. At 100, the kernel will always prefer to find inactive pages and swap them out; in other cases, whether a swapout occurs depends on how much application memory is in use and how poorly the cache is doing at finding and releasing inactive items.

The default swappiness is 60. A value of 0 gives something close to the old behavior where applications that wanted memory could shrink the cache to a tiny fraction of RAM. For laptops which would prefer to let their disk spin down, a value of 20 or less is recommended.

  • First we have to gain access to your /etc/sysctl.conf file.

sudo gedit /etc/sysctl.conf

  • Just scroll to the bottom of the page and add the tag listed below. The number you want depends on how much ram you have and what you do with your system. Please read the about above this to make your decision. I have mine set to 0 on a dual core laptop with 1 gig of ram and have seen no issues and a good performance gain.

vm.swappiness=0

Broadband Internet

  • You have to open your /etc/sysctl.conf file back up again.

sudo gedit /etc/sysctl.conf

  • Then again, scroll to the bottom and just add these lines to it.

net.core.rmem_default = 524288
net.core.rmem_max = 524288
net.core.wmem_default = 524288
net.core.wmem_max = 524288
net.ipv4.tcp_wmem = 4096 87380 524288
net.ipv4.tcp_rmem = 4096 87380 524288
net.ipv4.tcp_mem = 524288 524288 524288
net.ipv4.tcp_rfc1337 = 1
net.ipv4.ip_no_pmtu_disc = 0
net.ipv4.tcp_sack = 1
net.ipv4.tcp_fack = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_ecn = 0
net.ipv4.route.flush = 1

  • You have to reset your sysctl for these to take effect.

sudo sysctl -p

IPv6

IPv6 is an internet protocol. Most of your software uses IPv4 though and it causes conflicts and could mean that your web browsing could slow down.

  • We are going to create a file. Paste this into a terminal.

sudo gedit /etc/modprobe.d/bad_list

  • Then paste this into the file and save and exit the file.

alias net-pf-10 off

All that is left to do is click "Save", close the window, and reboot your PC for the changes to take effect.

Boot Profile

You have just made a lot of changes to your system. Re profiling your boot will reorganize it and make it faster on boots afterwards.

  • Reboot your PC.
  • When you come to your grub list, hit escape to see your grub menu.
  • Edit the topmost line and add the word below to the end of it.

profile

  • Then just reboot the system.

Faster Gnome/UBUNTU Menus

I’ve noticed that sub-menus tend to be a little “sticky”. It seems there is a 1/4s delay in usability. 

Click "Places", "Home Folder". Now, we need to create a file called .gtkrc-2.0. To do this we right-click on any white space and move our mouse over "Create Document" and click "Empty File". We now rename this file to .gtkrc-2.0.

We will now double-click the ".gtkrc-2.0" file you just created and add the following line to it;

gtk-menu-popup-delay=0

Click Save and close the window.  You will have to log back in to see the results.

If you feel your Ubuntu menus open too fast now and would like to make them slower, the suggested optimal speed is:

gtk-menu-popup-delay=100

However, for you to be able to edit ".gtkrc-2.0" again we need to tell Ubuntu to show hidden files.

Go back to your "Home Folder"

Click "View" and a menu expands. In this menu you will find something called "Show Hidden Files", click it.

You will now be seeing a whole bunch of files you have never seen before. Find the file called ".gtkrc-2.0", open it and delete gtk-menu-popup-delay = 0, replace it with gtk-menu-popup-delay = 100.

If for whatever reason you do not like this tweak, it is safe to delete the file called ".gtkrc-2.0" and all will be back to normal.

Disable the Splash Screen

Although the Splash Screen may be lovely, by disabling it you can find yourself at your desktop and working 3-4 seconds faster.

From your Ubuntu menu click SystemPreferences - Sessions.
We now want to un-check the box that says Show splash screen on login. Click "Close".

  • Share/Bookmark

Tags | , , ,

Acronis True Image Home 2010

3 Comments For This Post

  1. Marcelo Says:

    Nice tips!

  2. Marcelo Says:

    Look at this site for more tips about swappiness http://www.serbuntu.net

  3. greg Says:

    The first “tip” is extremely dangerous for your data. You lose integrity built into a journaling file system. If what you really want is a file system without a journal… so your computer is faster, and loses your data when it crashes, then you should use ext2.

Categories