Optimising Slackware boot time (part 1).

21 02 2009

Hi all! This is easily going to be my most in depth post so far, so buckle up…


As you may know, Slackware is widely regarded as one of the most lightning-fast Linux distros. Nevertheless, this isn’t enough for some of us pedantic OS hackers.

My aim was to boot the test system with all required services and a media centre system on top in under 1 minute. On previous Slackware installs this had taken up to 2.5 minutes from power-on to operational (Slack 10.1 and ReiserFS on a 160Gb IDE HDD). This is absolutely ridiculous. My aim has been to get it down to well under 1 minute, and this meant getting the initial bootup to around 20 seconds, as the software takes around 20 seconds to initialise, leaving up to 20 seconds for POST on a VIA EPIA EN15000G, which should be easily enough.

While this may sound difficult, it’s really not that bad. The Slackware boot process (in a much simplified form) works in the following sequence:

1 – Kernel loaded
2 – Initrd/initramfs loaded
3 – rc.S executed (runlevel 1)
4 – rc.M executed (runlevel 2/3)
5 – X started (runlevel 4)

Time to make a plan

I knew that ReiserFS was out of the question for data partitions, as recovery of the journal takes an absurd amount of time. I eventually decided on Ext3 for system partitions and JFS for the media partition. The change from ReiserFS on the system partitions came given the uncertainty of it’s future.

I chose Ext3 over Ext4 because I feel that Ext4 is still a little bit too recent to be trusting an entire system with, however give it a year or two and there will be no question. If you’re interested in looking up Ext4, there’s an in depth review of it here. It looks worlds better than even Ext3.

I chose JFS for the data partition as it’s very fast and deals with large files really well, making it ideal for digital media. Also it’s journal recovery speeds are really fast, allowing me to keep boot time to a minimum.

Ok… On with the hack!

Right… Now we’ve got a plan we can start the implementation.

The first stage is to install Slackware from the DVD. I’m using 12.2, as it’s the latest and greatest, and will STILL more than happily run on a 1.5GHz machine.

If you’ve ever installed Slackware before, you’ll know that you’ve got to do all of your partitioning beforehand. I tend to use CFDisk after booting from the DVD, but if that all looks a bit daunting, a nice easy way to partition is to download the GParted LiveCD, which lets you do it all through a graphical interface.

My partitions run as follows:

hda1 – 500Mb – /boot
hda2 – the rest – extended partition to contain others
hda5 – 1Gb – SWAP
hda6 – 500Mb – /home
hda7 – 2Gb – /
hda8 – 5Gb – /usr
hda9 – 1Gb – /var
hda10 – Whatever’s left – /home/media

I’ll post the next section later today. Don’t want to put it all into one post, as it’ll be hugely too long. Don’t want to cause a case of tl;dr.