Sunday, August 15, 2010

grub2 boot profiling

Booting times in Linux have never been a big deal to me.  Fast or slow, it really doesn't matter much, and it surprises me sometimes that folks pay so much attention to it.  It never seems that slow to me!  Maybe I should start using a stop-watch.

Anyway, I don't know if "boot profiling" in grub2 is a Ubuntu-only thing (I'd be surprised if it is), but so far I've only seen it mentioned for 'Buntu distros.  Kinda funny to me, because whether it's Lucid, Isadora, or Squeeze, the boot times here seem quite fast, except for when there's a hard drive check going on.

Anyway, here are the steps:

For grub2:  As root, open /etc/default/grub and add the word "profile" to the GRUB_CMDLINE_LINUX_DEFAULT line.  My default in Ubuntu Lucid is:

So, that's changed to:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash profile"

Save; then, as root, run update-grub.

The next boot will be slower than usual while profiling takes place.

Go back to /etc/default/grub, remove the word "profile" that you added, save the file and run update-grub again.  Subsequent boots are supposed to be much faster than they were before the profiling.

I've seen these "boot profiling" steps mentioned for Linux Mint as well as for Ubuntu.  Haven't tried it in either distro.  

An alternate approach I found:
1. At your boot screen press “e” (for edit).
2. Use your arrow key and move down to the entry beginning with “kernel”.
3. Press “e” again.
4. Add “profile” (no quotes) at the end of this line.
5. Hit Enter.
6. Click “b” (for boot).

 Here's a Debian Wiki article that discusses using readahead to accomplish the same thing.  Looks like this is for grub-legacy.

No comments: