Tips for a faster Ubuntu machine!

Feb 15, 2007 15:56 GMT  ·  By

Either you use Ubuntu, Kubuntu or Xubuntu Edgy version as your Linux distribution, which everyone knows it's a pretty fast Linux operating system, you can also do some tricks in order to get a boost. I will teach you today some quick hacks on how to improve the overall performance of your system.

WARNING: Please follow the instructions below very carefully, if not, your operating system will not work anymore.

1. Filesystem tweaks

The following tweaks are for EXT3 and ReiserFS filesystems

Open a console and type:

code
sudo gedit /etc/fstab
Add the following options marked in bold to the root mount line. In other words, it should change from this:

# /dev/hda3 UUID=f4d4d73d-4141-4701-a7e2-ec41664483a7 / ext3 defaults,errors=remount-ro 0 1

into this:

# /dev/hda3 UUID=f4d4d73d-4141-4701-a7e2-ec41664483a7 / ext3 defaults,errors=remount-ro,noatime,data=writeback 0 1

Now type the following command in the console:

code
sudo gedit /boot/grub/menu.lst
And add this option:

rootflags=data=writeback

to the end of the following lines:

# defoptions=quiet splash rootflags=data=writeback

# altoptions=(recovery mode) single rootflags=data=writeback

Now save and close, and type the following command in the console:

code
sudo update-grub
Type now the following command in order to manually change your filesystem "on-the-fly" into writeback.

NOTE: Please note that /dev/hda3 is my root (/) partition. If you have the root (/) partition in another place, change it accordingly. Please look in /etc/fstab for this!

WARNING: The next trick is only for EXT3 filesystems! For ReiserFS this will NOT work, so don't run the following command, just reboot your system for the changes to apply.

code
sudo tune2fs -o journal_data_writeback /dev/hda3
That's all, now reboot your system and when you get back, you should feel an increase in video, image or audio usage.

2. Start applications faster with Prelink

What is Prelink and how can it help me?

Prelinking can cut the startup times of applications. For example, a typical KDE program's loading time can be cut by as much as 50%. The only maintenance required is re-running prelink every time a library is upgraded for a pre-linked executable.

Open a console and type the following command:

code
sudo apt-get install prelink
Now run the following command:
code
sudo gedit /etc/default/prelink
And change this option:

PRELINKING=unknown

as to look like this:

PRELINKING=yes

You can also change some other options in that file, if you know what you are doing. Save and close.

To start Prelink, type the next command in the console:

code
sudo /etc/cron.daily/prelink
This will take some time to finish (around 10-15 minutes).

If you want to run Prelink every time you update something in your system, add a script to the /etc/apt/apt.conf.d/ folder, called S99prelink, and put the following line into it:

code
DPkg::Post-Invoke {"echo Running prelink, please wait...;/etc/cron.daily/prelink";}
3. Enable DMA on IDE Hard Drives

If you have an IDE hard disk, you can check if Ubuntu enables DMA mode on it.

WARNING: If you have a SATA hard disk, this tweak is NOT necessary.

Let's check first if you have DMA enabled or not on your drive. Type the next command in the console:

code
sudo hdparm /dev/hda
NOTE: Replace /dev/hda with your hard disk location.

If you see using_dma = 1 (on) then it's ok. If not, enable the DMA mode by running the following command:

code
sudo hdparm -d1 /dev/hda
NOTE: Replace /dev/hda with your hard disk location.

Either you have DMA already enabled or you've just enabled it, run the following tweak in order to activate DMA mode at boot time.

code
sudo gedit /etc/hdparm.conf
And add the following to the end of this file:
code
/dev/hdc {
dma = on
}
Remember to leave a blank line after the above code and save/close the file.

That will be all for now, please report if you see any improvements to your system. If anyone has more improvements, you can post them here anytime, so others will know about them!