Improve boot performance

From ArchWiki
Revision as of 15:37, 14 November 2012 by WonderWoofy (Talk | contribs) (Avoiding remounting - changed title to cover all included advice, and expanded on existing info.)

Jump to: navigation, search
Summary help replacing me
This article attempts to aggregate methods on how to improve the boot performance of an Arch Linux 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 an Arch Linux system.

Identifying bottlenecks

The systemd-analyze command can be used to show timing details about the boot process, including an svg plot showing units waiting for their dependencies. See man systemd-analyze for details.

Compiling a Custom Kernel

To decrease boot time, a stripped kernel is a must. Read more about compiling a kernel.

Staggered spin-up

Some hardware implements staggered spin-up, which causes the OS to probe ATA interfaces serially, which can spin up the drives one-by-one and reduce the peak power usage. This slows down the boot speed, and on most consumer hardware provides no benefits at all since the drives will already spin-up immediately when the power is turned on. To check if SSS is being used:

$ dmesg | grep SSS

If it wasn't used during boot, there will be no output.

To disable it, add libahci.ignore_sss=1 to the kernel line.

Filesystem Mounts

Thanks to mkinitcpio's fsck hook, you can avoid a possibly costly remount of the root partition by changing ro to rw on the kernel line and removing it from /etc/fstab. Options can be set with rootflags=mount options... on the kernel line.

You can also remove API filesystems from /etc/fstab, as systemd will mount them itself (see pacman -Ql systemd | grep '\.mount$' for a list). It is not uncommon for users to have a /tmp entry carried over from sysvinit, but you may have noticed from the command above that systemd already takes care of this. Ergo, it may be safely removed.

Other filesystems like /home can be mounted with custom mount units. Adding "noauto,x-systemd.automount" will buffer all access to that partition, and will fsck and mount it on first access, reducing the number of filesystems it must fsck/mount during the boot process.

Additional Resources