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…

Introduction

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.

n00b

About these ads

Actions

Information

7 responses

12 06 2009
Stefan

I just came across your blog. Lots of good stuff. I’m especially intrigued by this posts title. Great start, but where is part 2 and 3…?

I’m curious if you can indeed get to under 1 minute.

Thanks Stefan

6 08 2009
n00bsys0p

Hi Stefan. Thanks for the compliment. It’s nice to know my efforts are appreciated.

Here’s links to parts 2 and 3 if you are still having trouble locating them:

http://n00bsys0p.wordpress.com/2009/02/21/optimising-slackware-boot-time-part-2/
http://n00bsys0p.wordpress.com/2009/03/01/optimising-slackware-boot-time-part-3/

I had the total bootup time to under 25 seconds from POST to X, then another 20-30 seconds from then to the box being completely operational.

I don’t know if you’d necessarily manage this on a normal PC, as the device we are using has autologin, doesn’t use a window manager and just uses xinit scripts to start a proprietary front end.

Try fluxbox or something along those lines for a normal machine. It’s a tiny little window manager with a decent level of functionality. I like the way you can remove the window decorations with great ease. Really useful for kiosk style browser-only machines.

Anyway, I hope you achieve as fantastic results as I did.

n00b

6 08 2009
Loki

Is that a mistake in your partitioning? /boot = 500Mb, /home = 500Mb, on a 160Gb drive?

I can understand 50Mb for /boot and 5Gb for /home…… but your numbers seem strange.

6 08 2009
n00bsys0p

Hi Loki,

Actually they’re the exact values I was using. They are a little odd, but hopefully I’ll be able to shed some light… The device I was actually modifying the boot process on was an internet connected jukebox for the company I work for. The boot partition contains a whole bunch of proprietary stuff, and the home partition is pretty much unused.

Hope that’s explained it.

n00b

25 08 2009
David

19 seconds from boot to KDM login screen. Checked with bootchart. Could be less if not for X startup. (actually, I made 15 seconds with everything fully functional *except* my wireless card, so I reverted to 19 seconds). Any ideas?

26 08 2009
n00bsys0p

Hi David,

Wow! That’s some impressive timings! Was this just using the methods I described? Also I’d be much appreciative if you could post your HW specs, so I can make comparisons with my results.

In fact if anybody else has used these methods, I’d like to see your results and HW specs too. If enough people respond to this, then I’ll add a whole new page on here for bootup timings and specs. Bootchart PNGs are the best way to display this if you can manage it. I’ll add this request to the main article now too.

Have you thought about trying to initialise your wireless card earlier in the boot process? If you could tell the system to load the modules for your WiFi earlier on, then it should be ready for action by the time you’re fully functional. If on the other hand it’s the connection that’s taking too long, try rewriting your boot scripts to put the WiFi module loading AND connection earlier on.

Hope that’s of help!

n00b

29 01 2012

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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




Follow

Get every new post delivered to your Inbox.

%d bloggers like this: