Making Linux boot faster

I’ve been a committed Linux user for the past 3 years now (though I’ve developed a liking for the Mac platform too) and currently I dual boot Vista and Arch Linux on my laptop. It’s a pretty rare ocassion for me to actually boot into Windows, mostly it’s just a game of SimCity 4. But whenever I do I’m really hate how much slower it is than my Linux install. What I hate even more is how even after I log in my system is still unusable for a good 20 seconds while everything finishes loading in the background.

By comparison, my linux install takes just 30 seconds to get to a usable desktop. Admittedly, what I boot into isn’t really a ‘desktop’ in the traditional sense of the world. I run Stumpwm, a lightweight tiling window manager, I don’t have fancy 3d graphics, I don’t even have a taskbar or desktop icons. That being said, I do boot into a fully usable system with an active wireless network connection.I was quite happy with the 30 second boot time until I came across an article about a group of researchers who managed to make a linux system boot in 5 seconds. Needless to say a 5 second boot time is really impressive and makes my boot time look extremely sluggish by comparison. 

With Thanksgiving Break around the corner, I’m considering putting some time into a building an experimental system in order to see just how fast a boot I can get. Chances are I’ll be using an older Dell machine, but I’m not sure about the specs yet. There are two main steps I’ll be taking to cut down on boot time:

1. Cutting down on unnecessary processes

A standard linux boot often starts up a number of processes and tasks that aren’t really needed on a normal single user system. Namely, I don’t need a Cron scheduler, nor do I need any type of mail server to be started. Since I never print, I can get rid of CUPS too. I use a lightweight graphical login manager called Slim, but if I wanted to shave another second or two, I could boot straight to a logged in desktop.

2. Making changes to the kernel

Since I’ll know exactly what hardware I’ll be running, I can build a custom kernel with appropriate modules for the devices built right in. However, I’ll still need to start the Hardware Abstraction Layer and udev so that I can use hotplugged devices (USB drives and the like). Since this is an experimental machine, I probably could remove the need for hotplugging, but I think in the real world, that crosses the usability line in the wrong direction. 

Adding things directly into the kernel has a two-fold effect: firstly I no longer have to wait for the modules to be loaded separately later in the boot process. Secondly, I’m trying to figure out if this will allow me to get rid of the initial ramdisk. Arch linux boots up by having the kernel load up a compressed disk image into the RAM which contains the basic modules needed to get on with the boot: mostly hard drive modules. This then lets the kernel mount the root filesystem and get on with the boot process. Removing the need for a ramdisk might be a significant time boost and is something I will definitely be looking into. 

I doubt whether I’ll be able to get a boot time under 10 seconds, especially since I won’t be making any source level changes. I’ve been looking for information to see if a different filesystem (other than the popular ext3) would have a noticeable impact, but I haven’t been able to find any concrete information yet. I might be looking around at some other kernel patches. Unlike the researchers mentioned above I won’t be making any changes to X or implementing readahead (which lets the kernel look ahead to see which filesystem blocks need to be loaded next). As always, I’ll be keeping a log of my activities and I should have some interesting results.


Published by

Shrutarshi Basu

Programmer, writer and engineer, currently working out of Cornell University in Ithaca, New York.

One thought on “Making Linux boot faster”

  1. Back in 1999 when I was using Slackware as my primary machine I had it trimmed down to ~ 17 seconds from power-on to console login screen. I believe I was running a P2/450 at the time. I was amazed at how much cruft I was able to remove from the default kernel build.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s