The Linux Blog

2/22/2005

Optimizing Gentoo (Part 2)

Filed under: — Clete R. Blackwell 2 @ 1:19 pm

Note: If you get errors when saving, try erasing all the quotation marks and re-inserting them. WordPress likes to mess them up. One error was also fixed below and is noted by [Edit] and [/Edit].

After checking out the optimizations in my last Optimizing Gentoo article, you may want to try a few of these.

Boot Time Optimizations

These tricks will speed up boot time, some more than others. To start out, let’s mount all local devices simultaneously instead of in a sequence.

Look for this in /etc/init.d/localmount:

mount -at nocoda,nonfs,noproc,noncpfs,nosmbfs,noshm >/dev/null

[Edit]
It may also say something like this:

mount -at noproc,noshm,no${NET_FS_LIST// /,no} >/dev/null

Whatever it says, just make sure it says mount -aFt in the beginning and it should work.
[/Edit]

and change it to this:

mount -aFt nocoda,nonfs,noproc,noncpfs,nosmbfs,noshm >/dev/null

Not only can you mount drives simultaneously, you can even start services simultaneously.

In /etc/conf.d/rc, change this:

RC_PARALLEL_STARTUP="no”

to:

RC_PARALLEL_STARTUP="yes”

Now that all services will start simultaneously and all drives will mount simultaneously, we need to go even further by running modules-update and env-update only when needed.

/etc/init.d/bootmisc

Change:

if [ -x /sbin/env-update.sh ]
then

ebegin “Updating environment”
/sbin/env-update.sh >/dev/null
eend 0
fi

to:

if [ -x /sbin/env-update.sh ]
then
if [ /etc/env.d -nt /etc/profile.env ]
then
ebegin “Updating environment”
/sbin/env-update.sh >/dev/null
eend 0
else
einfo “Environment up-to-date”
fi
fi

/etc/init.d/modules

Change:

ebegin “Calculating module dependencies”
/sbin/modules-update &>/dev/null
eend $? “Failed to calculate dependencies”

to:

if [ /etc/modules.d -nt /etc/modules.conf ]
then
ebegin “Calculating module dependencies”
/sbin/modules-update &>/dev/null
eend $? “Failed to calculate dependencies”
else
einfo “Module dependencies are up-to-date”
fi

Using rc-update

Gentoo has an unique initialization (init) system, but they have simplified it for users greatly. A great use of the system for a laptop is to use a different and minimized runlevel when on batteries as opposed to being plugged into an outlet. Runlevels may be changed while the machine is running or specified at a boot screen. Another situation is for gaming. If you don’t have much RAM and have unnecessary processes running, then it will slow your computer down slightly.

One of the best resources that tells you how to use rc-update and runtimes is right in the Gentoo handbook, or more specifically here

If you haven’t read all the extra documentation, I suggest at least skimming it. More to come, as usual, as I find it.



Powered by WordPress