Improve boot performance
|Summary help replacing me|
|This article attempts to aggregate methods on how to improve the boot performance of a system.|
Improving the boot performance of a system can provide reduced boot wait times and a means to learn more about how certain system files and scripts interact with one another. This article attempts to aggregate methods on how to improve the boot performance of a system.
Modifying boot files
The initscripts can be started asynchronously instead of running in a strict order.
# use once instead of wait rc::sysinit:/etc/rc.sysinit rs:S1:wait:/etc/rc.single rm:2345:once:/etc/rc.multi rh:06:once:/etc/rc.shutdown su:S:once:/sbin/sulogin -p
Comment out unused terminals
agetty terminals are console terminals brought up by Ctrl+Alt+F1-6.
- Comment out unused terminals if only two terminals (tty1 and tty2 are required:
c1:2345:respawn:/sbin/agetty -8 38400 tty1 linux c2:2345:respawn:/sbin/agetty -8 38400 tty2 linux #c3:2345:respawn:/sbin/agetty -8 38400 tty3 linux #c4:2345:respawn:/sbin/agetty -8 38400 tty4 linux #c5:2345:respawn:/sbin/agetty -8 38400 tty5 linux #c6:2345:respawn:/sbin/agetty -8 38400 tty6 linux
# pacman -S fgetty
Change the following lines in Template:Filename to reflect the use of fgetty:
c1:2345:respawn:/sbin/fgetty tty1 linux c2:2345:respawn:/sbin/fgetty tty2 linux
This file lets you modify the kernel command line at boot. A couple ways to speed up boot time using this file to modify the kernel commandline is to remove framebuffer entries, and set the kernel loglevel to a lowlevel of logging with quiet. For more kernel parameters and Template:Filename examples check out the archlinux page on GRUB. Remove existing vga= framebuffer resolution entries and logo.nologo, parameters to the desired kernel:
kernel /vmlinuz26 root=/dev/disk/by-uuid/UUID ro logo.nologo quiet
Delete the HOOKS you don't need, and consider using just base (sometimes udev is needed too) along with the MODULES you need for your root device (and keyboard, instead of usbinput).
Read more in the mkinitcpio article.
In the network section, make sure you only load the network interface you need. Manually configuring your network is also faster than using dhcp. Then find and remove all DAEMONS you don't need.
DAEMONS=(alsa network gdm)
Then move your Xdm to front, and background all DAEMONS.
DAEMONS=(@gdm @alsa @network)
Another thing you could do about daemons is finding the best, or rather, "sweetest" arrangement.
DAEMONS=(syslog-ng @acpid arptables iptables network pdnsd @alsa @dbus @mpd @crond @sensors @ntpd @dropboxd)
You should try to background as many DAEMONS as possible, making sure to start dependent DAEMONS after what they require (in the above example, pdnsd depends on network, ntpd and dropboxd depend on pdnsd and network, because 127.0.0.1 is the dns server). You can still background daemons that are required by other things (dbus is required by the Xorg), but they need enough time to start (it can take some experimentation to get it all to work well).
This script is responsible for the majority of output you see during boot, meaning this is a system-critical configuration file which looks up other files like rc.conf and loads modules, sets up mounts, handles errors, and basically tries to be your best friend.
There are certain lines here which you may not need. Removing or commenting them out may save you a few seconds at most. Do this at your own risk. For example, if you do not have RAID, LVM or encryption, then you would not need any lines concerning that.
It's also possible to add some ampersands (&) to make it more asynchronous, but be careful - lots of things are expected to be finished during later parts of the script.
Compiling a Custom Kernel
To decrease boot time, a stripped kernel is a must. Read more about compiling a kernel.