|
|
|
|
|
Optimize Ubuntu 8.04 for SpeedSpeed up Hardy Heron! |
By Marius Nestor, Linux Editor
24th of May 2008, 09:24 GMT
Adjust text size: 
|
| |
So what if Ubuntu is a fast operating system?... There is always room for some more tweaking... and I am talking here about some aspects that are NOT useful for the end-users (yes YOU, the regular Ubuntu user). The hacks presented in this guide will greatly improve the overall performance of your Ubuntu 8.04 Linux OS.
WARNING: Please follow the instructions below very carefully, in the order in which they are listed and reboot your machine after each one. It is also possible to do them all at once, but rebooting after each one is much safer. Why? Because if your system won't work properly at a certain point of the tutorial, you'll know what's the last thing you did and you can revert back to the initial configuration. I've applied all these tweaks on three (3) different configurations (with SATA and IDE hard drives) with success!
Step 1 - Boot tweaks
Tweak One - Boot profile Administration -> Login Window...
...input your password, go to the fifth tab ("Security"), check the 'Enable Automatic Login' option and choose your username from the drop-down list.
That's
it! Close the window and reboot. You will notice that the system will automatically log you in and remember that you've just lost a few important seconds!
Step 2 - System tweaks
Tweak One - Speed up your hard drive
The following tweaks assume that you are using an ext3 filesystem for your Ubuntu OS and they will offer a noticeable performance boost! However, there is also a bad side of them... if you don't have an UPS and your system will power off accidentally or because of a power loss, YOU WILL LOSE IMPORTANT DATA!
Open a terminal (Applications -> Accessories -> Terminal) and type:
CODE sudo gedit /etc/fstab
WARNING: The following is just an example! Do NOT copy the lines into your /etc/fstab file! Just REPLACE the options marked with underline with the ones marked with bold!
From this:
# /dev/sda1 UUID=19f70288-7340-40c0-82d1-ee4b218fee1d / ext3 relatime,errors=remount-ro 0 1
To this:
# /dev/sda1 UUID=19f70288-7340-40c0-82d1-ee4b218fee1d / ext3 noatime,nodiratime,errors=remount-ro,data=writeback 0 1
See the following screenshot if you do not understand...
Save and close. Now type the following command in the terminal:
CODE sudo gedit /boot/grub/menu.lst
And add the following option...
rootflags=data=writeback
...to the end of the following lines:
# defoptions=quiet splash vga=795 (by default, Ubuntu doesn't have the "vga=795" option on this line. It appears if you did the second tweak from the first step (see above)).
# altoptions=(recovery mode) single
They must look like this...
Save and close, and paste the following command in the terminal:
Type now the following command in order to manually change your filesystem "on-the-fly" into writeback.
CODE sudo tune2fs -o journal_data_writeback /dev/sdb2
ATTENTION: Please note that /dev/sdb2 is MY root (/) partition. If you have the root (/) partition in another place (for example /dev/sda1 or /dev/sda2) change it accordingly. Please look in /etc/fstab for this!
That's all, now reboot your system and when you get back, you should feel an increased speed in video, image or audio usage.
Tweak Two - Tuning Swappiness
If you have been running Linux systems for some time and you have used applications like 'top' to see what's going on in your machine, then you've probably wondered: Where has all my memory gone? You should know that the largest place it is being used in is the disk cache, as the cached memory is free and it can be replaced anytime if a newly started application needs that memory. Linux systems are made like this to use so much memory for disk cache because the RAM is wasted if it is not used and if something needs the same data again, then there is a very good chance to be in the cache memory.
Open a terminal (Applications -> Accessories -> Terminal) and paste the following code:
CODE sudo gedit /etc/sysctl.conf
Now add the following line at the end of this file:
The number at the end of this line can be between 0 and 100. At 100 the Linux kernel will prefer to find inactive pages and swap them out, while value 0 gives something close to the old behavior where applications that wanted memory could shrink the cache to a tiny fraction of RAM. Save, close and reboot.
Tweak Three - Concurrent booting
If you have a dual-core processor or one that supports hyper-threading then concurrent booting allows Ubuntu to take advantage of them. Just open a console and type the following code:
CODE sudo gedit /etc/init.d/rc
and find the line CONCURRENCY=none and change it to:
Save, close and reboot your computer.
That will be all for now. With these tweaks, your system should perform better and boot faster. Please report if you see any improvements to your system and if anyone has more improvements, you can post them below so others will know about them!
|
|
| Rating: |
|
Good (3.4/5) |
15 vote(s) so far |
|

|
|
|
User opinions: |
| Comment #1 by: rudlavibizon on 25 May 2008, 13:20 GMT | reply to this comment | Step two tweak one broke my installation. X-server couldn't start. I did a backup of fstab and menu.lst but could only revert them using a live cd because / partiton was apparently mounted as read-only. I wonder if it has something to do with # comments in menu.lst not being unchecked? Be careful people! |
| Comment #1.1 by: Marius Nestor on 25 May 2008, 16:28 GMT | As you can see from the screenshots in the guide, I've applied these modifications to my system with success. You probably copied the fstab lines in the example into your fstab file!
The lines in the menu.lst file are supposed to be with an # in front of them! The ones that are commented out are with ##. |
| Comment #1.2 by: josh on 08 Jun 2008, 06:31 GMT | Same here, tweaking /etc/fstab broke by graphical environment too. This is the 2nd time it happened. Frankly, I didn't think modify partitions would do this. Oh well, live & learn. |
| Comment #1.3 by: foi on 22 Jun 2008, 04:10 GMT | it also happened to me. could someone please tell me how to fix my /etc/fstab
i try: vi /etc/fstab but it wont let me save,
please help |
| Comment #1.4 by: John on 05 Jul 2008, 02:23 GMT | In response to the not being able to save thing... you have to be a super user to save a file like that. So instead of just vi filenamehere type, sudo vi filenamehere |
| Comment #1.5 by: scott on 05 Jul 2008, 13:01 GMT | try using 'sudo' before this command |
| Comment #2 by: OgreProgrammer on 27 May 2008, 11:30 GMT | reply to this comment | I can confirm that the fstab trick busts certain installs. It worked on my little acer xubuntu 8.04 and busted the file system for my ubuntu 8.04 desktop. i could not and did not copy paste as I use a third machine to show this tutorial.
on the fstab portion i did not find a significant improvement and would suggest just skipping it. |
| Comment #2.1 by: Marius Nestor on 27 May 2008, 13:14 GMT | OgreProgrammer, I am curious to know what type of hard drives do you have on those computers you mention. Are they both SATA or IDE? Or one is SATA and the other one is IDE? |
| Comment #3 by: octavian on 27 May 2008, 21:04 GMT | reply to this comment | About teak one..I have to mention that on my toshiba laptop booting process is longer every time. It's like it's creating grub profile everytime it's booting. Is that normal ? |
| Comment #4 by: ranny vargas on 28 May 2008, 04:42 GMT | reply to this comment | hey hows it going. i by no means am no Linux expert i aint even close to being an amateur but the entry into fstab errors=remount-ro, will for sure lock people out of their OS.when the drive remounts on boot and any mistakes are found. the system switches over to READ ONLY. on the / drive. therefore not letting anything load up right. thats why the X window wont open up.. my 2 bits on this one..and i know im right! :0) |
| Comment #4.1 by: Marius Nestor on 28 May 2008, 05:48 GMT | Wrong! The "errors=remount-ro" mount option is already on your system, therefore it's not the one that "breaks" the installation... I've applied the tweaks on 4 computers.. all with success! |
| Comment #4.2 by: ranny vargas on 29 May 2008, 03:00 GMT | well mister linus tovald.or whatever it is. its teh solution for my particular problem. which is happening apparently to some other peeps.. so go ahead take off that mount on error . and the problem will be gone |
| Comment #4.3 by: kendon on 29 May 2008, 14:52 GMT | well dude, maybe there is some sence in mounting / read-only when errors are found. and maybe the better solution would be to fix the errors, instead of forcing your system to ignore them... jm2c |
| Comment #5 by: Brian on 28 May 2008, 05:44 GMT | reply to this comment | How about how to do a preload of some often used programs like firefox, gedit, amarok, or anything else you can think of? |
| Comment #5.1 by: Marius Nestor on 28 May 2008, 05:49 GMT | Preload is not good for your system! Trust me! |
| Comment #5.2 by: vvvladut on 04 Jul 2008, 18:54 GMT | Why is preloading bad? And why should we just trust you? |
| Comment #5.3 by: Marius Nestor on 05 Jul 2008, 08:25 GMT | "preload is an adaptive readahead daemon that prefetches files mapped by applications from the disk to reduce application startup time." - from the original description of preload.
You already have a readahead daemon running on your Ubuntu machine (see the first tweak)! Also, preload was used long time ago... |
| Comment #6 by: Adarsh on 28 May 2008, 18:41 GMT | reply to this comment | Please be a little more descriptive of what these tweaks actually do, and what the available options are!
b/w how did you encrypt the disk? alternate disk? |
| Comment #6.1 by: Marius Nestor on 28 May 2008, 19:18 GMT | Yes, here is the tutorial -> http://news.softpedia.com/news/Encrypted-Ubuntu-8-04-85271.shtml
The tweaks are supposed to make the boot process faster with about 10 to 15 seconds less then the default installation... and will improve the overall performance of the system. |
| Comment #7 by: eumetaxas on 31 May 2008, 14:43 GMT | reply to this comment | Hi!
after applying the hard disk tweak when i try to extract an archive with archive manager it says "not enough memory". i have memory left according to system monitor.
what can i do?
thanx! |
| Comment #8 by: Rahul Dastidar on 04 Jun 2008, 11:45 GMT | reply to this comment | Hi,
This is a good article, but ..
One important part is missing .. (Must do to avoid crashing)
In Step-2,after tweak one
run the following command --->
sudo tune2fs -o journal_data_writeback /dev/ |
| Comment #9 by: Eugene on 08 Jun 2008, 18:30 GMT | reply to this comment | This article is the first step to study linux recovery after unexpected power down. :) |
| Comment #10 by: Pete Martin on 21 Jun 2008, 00:12 GMT | reply to this comment | Regarding the last step - the swappiness tweak. I think you need to go and read about how swappiness actually works.
First of all this step is completely unnecessary for a lot of users since most machines nowadays will have upwards of 1G of ram and will hardly, if ever, need a swapfile.
Swappiness only works it's magic when the system is idle, so won't be using up any system resources when you need them, and doesn't actually remove any of the information from ram, jsut means that that space can be used immediately if need rather than after a delay while the swap takes place.
Swappiness is generally considered to be a Good Thing and setting it to zero is only adviseable on very rare occassions.
There is a reason someone decided to code it in the first place, and why almost all distributions include it. |
| Comment #11 by: njt on 26 Jun 2008, 07:39 GMT | reply to this comment | I am amazed that XFCE and other window managers have not been discussed when trying to improve performance on older pc's. I use XFCE(Xubuntu) because I like the un-cluttered environment and because I have an older PC (Athlon XP 1700 and 512mb RAM).
There are other similar options like Blackbox and Fluxbox but the advantage of XFCE is that it looks almost exactly the same as gnome. It is very much slimmed down so if you care that your icons perhaps are a little sharper or more detailed then don't bother. If on the other hand you would like to see plenty of old hardware in perfectly working condition then this is a great option and any of the above tweaks that work are still applicable. You could turn off all the background task it would just require you to navigate slightly different menus (better menus IMHO).
Also, if I could recommend not trying to un-install Gnome or KDE. It is very tricky to completely remove these desktop environments, rather boot a Xubuntu live CD, decide if you like the way it looks or not (bearing in mind that you can't really tell performance from a Live boot) and install from scratch.
One final note: You can still have Compiz! It takes a bit of Googling around to find a howto to get it working (to save you the time: http://ubuntuforums.org/showthread.php?t=203877) but Compiz still works |
| Comment #12 by: gerben1 on 29 Jun 2008, 15:44 GMT | reply to this comment | Could someone please post how to repair your system after step 2 broke it?
The problem is your are left with a system that is mouted Read Only, so you cannot change anything back. |
| Comment #12.1 by: oren on 05 Jul 2008, 03:47 GMT | here is my journey in the linux world:
ubuntu -> xubuntu -> debian xfce -> debian dwm (lightweight window manager, 30k of c code).
if you want lean and mean try debian.
it's almost identical to ubuntu but with less bloat.
xubuntu is also a great option, and you can try the alternate cd (it's the debian installer btw) which allows better customization. |
| Comment #13 by: Christoph on 30 Jun 2008, 05:38 GMT | reply to this comment | the fstab tweak broke my system, changed my disk to read only.. my simple fix:
Boot from live Ubuntu 8.04 disk
PLACES menu, chose the appropriate drive, mounted
sudo gedit /media/disk//etc/fstab
changed back to relatime,errors=remount-ro
rebooted and all is well again! |
| Comment #14 by: budjo on 05 Jul 2008, 05:06 GMT | reply to this comment | X-server couldn't start but we can login using command line, type in username and password. Then type this command to fix problem:
sudo tune2fs -o journal_data_writeback /dev/sda1
it works for me
rgds |
| Comment #15 by: Edward on 05 Jul 2008, 07:01 GMT | reply to this comment | great tutorial!but i think the author missed an important point that removing the incomplete packages, isolated libries &residual Config package can also speed up ubuntu,please see this article for details:
http://www.linuxine.com/2008/06/speed-up-ubuntu-boot-speed.html |
| Comment #16 by: DS on 05 Jul 2008, 07:25 GMT | reply to this comment | The hard disk tuning options are rather dangerous. Setting write back mode will lead to data loss in the event of a power failure. Only use these options if you have a UPS, never use these options on a laptop! |
| Comment #17 by: John on 05 Jul 2008, 10:50 GMT | reply to this comment | I tried this and now Ubuntu only boots to busybox lol. |
| Comment #17.1 by: jbroome on 06 Jul 2008, 06:16 GMT | But it booted to BusyBox *fast* didn't it? |
| Comment #18 by: apelss on 05 Jul 2008, 14:11 GMT | reply to this comment | nodiratime is implied by noatime, so you don't need both in there, just noatime will suffice. |
| Comment #19 by: guest on 07 Jul 2008, 13:28 GMT | reply to this comment | I've got this problem to, and it's really annoying, but fortunately I installed Zenwalk 5.2 and see fstab configuration
"default,noatime"
and use this to my Hardy (just add noatime) and it works
but thanks for other trick, thats really useful |
| Comment #20 by: Anon on 29 Aug 2008, 22:47 GMT | reply to this comment | It is better to add:
CONCURRENCY=shell
to /etc/default/rcS as that file is later sourced by /etc/init.d/rc and is the more correct way to manage initscripts. |
| Comment #21 by: UnklFungus on 09 Sep 2008, 01:17 GMT | reply to this comment | On Tweak two, do I add the the line to the very end of the file? This doesn't make sense based on what is shown. |
| Comment #22 by: EriktheUnready on 10 Sep 2008, 12:59 GMT | reply to this comment | Concurrency=shell used to work lovely before these last releases.
On 8.04 and Distro's based on 8.04 it breaks the network manager applet if yo change often. On Mint it 'breaks' the menu sometimes. I have installed almost 70 PC's & laptops with 8.04, so if your pc/ laptop does wierd things after the speedup, remove the concurrency=shell. Thanks 4 the tut! |
| Comment #23 by: Frank Horne on 10 Sep 2008, 14:21 GMT | reply to this comment | I got the auto login to work! Thanks. BUT I rebooted after I wrote the first command line in /etc/fstab. Broke my Grub! How do I get back in to wrire the other lines? I can get an Ubuntu shell. Thanks,
Frank |
| Comment #23.1 by: Frank Horne on 15 Sep 2008, 18:46 GMT | Got it worked out. Thanks you guys, for all the help.
Frank |
| Comment #25 by: Paul on 13 Sep 2008, 17:06 GMT | reply to this comment | Please note that
concurrency=shell
will most likely inhibit mounting of encrypted partition via pam-crypt. No idea why that is, though. |
| Comment #26 by: Michael on 22 Sep 2008, 06:45 GMT | reply to this comment | I only used the swapiness tweak.
I have an ubuntu 8.10 install (note: 8.10 has not come out yet, i am using the Alpha 4 version, which is updated now to alpha 6)
Anyways, in my effort to understand swap better, i earlier changed my swap to as large as i could make it -- 15 GB on my laptop that has 512 ram. I had the hd space. Why not?
Anyways, i followed this tweak and turned swappiness to 100 and there is a HUGE change for how fast things load. I dont have a program to quantitatively show the difference in load times, but i can tell a huge difference. |
|
|
|