The Linux optimization guide

Discuss anything about technology or computers here, other than programming.

The Linux optimization guide

Postby isickheadi on Tue Feb 28, 2006 9:02 pm

(For the Administration: I didn’t know where to put this topic, so if its in the wrong place please move it. Thank you)

Hi folks!
Well I decided to contribute something (I just badly want this shell *joke*). This will be a small tutorial on how to optimize your Linux system.
First of all, here is a quick overview of all the steps needed.

///Update (01.03.2006)
Thanks for the reply. I added an additional section called links. Look there for further information.

Optimization of boot up process
Recompile your kernel
Optimize your hard disk
Additional tips
Links

1.
We gonna start with the first step which is boot up optimization.
Do you install new hardware everyday? Obviously not. So we need to disable the service that is searching for new hardware every time you boot up.
Here’s how you do it.

(This are examples for specific distributions, just google this topic if you don’t know how to disable services)
///Linux Mandrake///
Mandrake uses a service called “Hard drake” to search for new hardware. This is how to prevent the system from loading it every time you boot.
--------------------------------------------------------------------------------------------------------------------------------
Go to console and enter the following.
su root (logs you in as root)
Start the program “Darkxservices” and disable Harddrake.
--------------------------------------------------------------------------------------------------------------------------------
///Linux Red-Hat///
In RedHat you have to disable kudzu (the service that RedHat uses) through the “redhat-config-services” configuration.


2.
Finished with the first step? Cool. Now lets go on to the second step.
I will not go into detail here. The process of recompiling your kernel has been described on the internet. many times before. I just will tell you why recompiling your kernel is useful.
You might now that your kernel is not optimized for your hardware and as well is not 100% matching your needs.
By recompiling it you set it up for your hardware (for example the CPU values) and you might as well want to disable some services that you don’t need and that are “eating” up additional system resources.
Just google this topic and you will be rewarded with a faster system.

3.
HD optimization is not always needed. But some distributions (old ones as well as new ones) refuse to use the full recourses of your HD.
This is how you fix this problem.
--------------------------------------------------------------------------------------------------------------------------------
Go to the console and type in the following.
hdparm -t /dev/name (this command checks your hard disk for performance. Replace
name with the name of your hard disk, for example sda)
This should return a reasonable value (for example 50 mb/s).
If you got a low figure then you might want to check your hard disk.
Enter the following command in the console.

hdparm /dev/name (don’t forget to replace name with your hard disk’s name)
This command will show the setting of your hard disk. I will not discuss what they mean, this is meant to be a short guide. Just use the “man” command and read about the values.

To fix the mess with your hard disk just enter the following comand:
hdparm /dev/nameX -d1m8c3u1 (Replace nameX with your disk, for example sda1. Read in the manual about the values.)

Now, if everything worked correctly safe it by typing in the following.
hdparm -k 1 /dev/hda

Now we are done with the hard disk optimization. Enjoy the additional speed.

4.
Its time for some additional tips.

If possible use the ext2 file system
Don’t forget to create a swap file (if you don’t know how to do it. GOOGLE)
Try to turn off some services that you don’t use. This will give you a faster start up and will also free up some additional system memory. (warning: Google this topic)
*lame tip* You might want to turn off some visualisation processes in KDE *lame tip*

5.
This section is called links. You can find additional info here. In case you know some good sites, please post them and Im gonna add them to the guide.

Kernel optimization:
(You should get a general Idea about it)
http://www.digitalhermit.com/linux/Kern ... HOWTO.html
http://www.linuxheadquarters.com/howto/ ... sons.shtml
http://www.redhat.com/docs/manuals/linu ... ernel.html

General service knowledge:
Slackware
http://www.slackware.com/config/init.php
http://www.slackbasics.org/html/init.html
General
http://www.comptechdoc.org/os/linux/sta ... uinit.html
http://www.linuxjournal.com/article/3016

Books
Slackware
http://www.slackware.com/book/


Im a bit lazy right now, this should do it for the beginning.




Well that’s it. If you find any mistakes, please let me now. You have any additional tips or techniques on how to speed up Linux, please add them to this topic.

***Remember I don’t take any responsibility for your action. If you destroy your system by doing something wrong while following this guide, don’t complain. You have been warned.***
Last edited by isickheadi on Wed Mar 01, 2006 5:10 pm, edited 1 time in total.
The one with the sick head.
isickheadi
Newbie
Newbie
 
Posts: 4
Joined: Thu Feb 23, 2006 10:30 pm
Location: London, UK

Postby Bugs42 on Wed Mar 01, 2006 1:52 am

Good stuff!
I didn't know about using Darkxservies to disabloe Harddrake before, I'll keep that in mind next time I install Mandrake.

Only thing I'd suggest is to add some links to tutorials for re-compiling the kernel.
Sufficiently advanced technology is indistinguishable from magic.
Bugs42
Valued Member
Valued Member
 
Posts: 189
Joined: Sat Dec 03, 2005 6:48 pm

Re: The Linux optimization guide

Postby ravenhair on Wed Mar 01, 2006 5:37 pm

First Off don't install anything your not going to use. This saves a lot of time and reduces security risks.

If your going to run the system as a server don't bother installing X windows.
isickheadi wrote:1.
We gonna start with the first step which is boot up optimization.
Do you install new hardware everyday? Obviously not. So we need to disable the service that is searching for new hardware every time you boot up.
Here’s how you do it.

///Linux Red-Hat///
In RedHat you have to disable kudzu (the service that RedHat uses) through the “redhat-config-services” configuration.


To check which services are enabled:
chkconfig --list

This will give you a listing of all services in the following format:
kudzu 0:off 1:off 2:off 3:off 4:off 5:off 6:off

This shows that kudzu is turned off in all run levels.

httpd 0:off 1:off 2:off 3:off 4:off 5:on 6:off
httpd is active in run level 5 only,

To turn services on and off:
chkconfig [--level <levels>] <name> <on|off|reset>

ex:
chkconfig httpd off # will turn httpd off in all run levels
chkconfig --level 3 on # will turn httpd on in run level 3

isickheadi wrote:4.
Its time for some additional tips.

If possible use the ext2 file system
Don’t forget to create a swap file (if you don’t know how to do it. GOOGLE)
Try to turn off some services that you don’t use. This will give you a faster start up and will also free up some additional system memory. (warning: Google this topic)
*lame tip* You might want to turn off some visualisation processes in KDE *lame tip*


ext2 works well and was the default standard. The only problem is that it is not a journaling filesystem and is not fault tolerant. If you kill the system you run the risk of data loss.

I reccomend ext3 it s backwards compatble but ads a journal allowing for full recover in the event of a failure.

swap is usually done as a parttion. while not required it is nessecary. This is where the system stores RAM data it's not currently using. you can create a swap file in the same idea as windows but it's not as easy or efficient. Most installers will create a swap partition for you.

RavenHair
RHCE
ravenhair
Regular
Regular
 
Posts: 80
Joined: Tue Nov 08, 2005 5:51 pm

Postby mankeke on Wed May 24, 2006 1:44 pm

maybe you can try Gentoo Linux, this distribution optimize the all thing you install, all packages are compiled for your architecture, try it and later you can tell me about your experience.
2b || != 2b
mankeke
Newbie
Newbie
 
Posts: 18
Joined: Sat Apr 01, 2006 10:17 pm
Location: chile - south america

Postby tasosos on Sun May 28, 2006 7:00 pm

In order for someone to recompile the kernel and be sure that it is going to work after the reboot...he must have a good knowledge of what he needs and what hardware he has in order to make the right choices.I will write down some commands for you aboout the recompilation of the kernel.

Tip:Before doing anything it's good to see what pci devices we have so i recommend lspci.

Then cd /usr/src/linux-2.6.16
make menuconfig
From the menu we change whatever we want only if we are sure what we are doing.
When we finish we close this menu and run make.With this we compile the kernel and then make modules_install in order to compile the modules that we want to load afterwards.
After this we have to copy the file bzImage from the path /usr/src/linux-2.6.16/arch/i386/boot/bzImage to path /boot/bzImage
You of course will need to change the kernel version number and arch to fit yours.Then we need to copy the System.map from /usr/src/linux-2.6.16/System.map to /boot/System.map

Tip:ln -s /usr/src/linux-2.6.16 /usr/src/linux

Finally we shall not forget to tell Grub or lilo or whatever about our new kernel so we will be able to boot it.

PS:This is not a complete how to but just the basics.
tasosos
Contributer
Contributer
 
Posts: 50
Joined: Sun May 28, 2006 10:39 am
Location: Greece-Ioannina


Return to Technology

Who is online

Users browsing this forum: No registered users and 1 guest

cron