HOWTO: Use Bootchart to Time and Track your Boot Sequence
This simple tutorial will describe how to use bootchart in order to get a graphical representation of the processes which run during your boot process. You will also be able to view the CPU and disk usage during your boot sequence, and will get an exact time (in seconds) of how long it takes for you to boot up.
Using bootchart is in no way difficult (and I present no new knowledge here), but it is my hope that this will introduce some in the Ubuntu community to bootcharting and give them an easy introduction to the topic.
There are various reasons that you may want to see what processes start along with your computer. Apart from satisfying your curiosity, getting a visual representation of your boot sequence may help you to fine tune your computer startup, or to diagnose why your computer may not be starting as quickly as you may like. Furthermore, getting a quantitative value for the time it takes to boot your computer will allow you to analyze how much of an improvement you make in the future
In order to track the boot sequence, we will use a program called bootchart. Installing it from the repositories is dead simple:
... And it's installed! No further configuration is necessary.
sudo aptitude install bootchart
Using bootchart may be even easier than installing it... Just reboot! After your machine starts up next time, bootchart will create a graphical representation of the boot sequence (as a .png file), and place it in /var/log/bootchart.
An example bootchart is attached. It was taken from an unoptimized boot sequence on my Thinkpad x61 running Hardy. You can see at the top that it took 30 seconds to boot completely, and there seem to be some places where optimizing the boot sequence (through parallelism) could possibly lead to a speedier bootup. But, such a thing is best left for another tutorial...
Bootchart will, unless disabled, chart every boot process after you've installed it. This may be overkill for most users, who only want to track their boot sequence occasionally. In order to stop bootchart from charting your boot sequence, simply remove its SysV script from executing after startup:
sudo update-rc.d -f stop-bootchart remove
Removing any system startup links for /etc/init.d/stop-bootchart ...
Re-enabling bootchart is as simple as disabling it. You may either reinstall it (through the repositories), or add it back to runlevels 2345:
That's it! It's so easy! I hope that this tutorial helps some of you to chart your boot process. Let me know if anybody runs into any issues.
sudo update-rc.d stop-bootchart start 99 2 3 4 5 .
Adding system startup for /etc/init.d/stop-bootchart ...
/etc/rc2.d/S99stop-bootchart -> ../init.d/stop-bootchart
/etc/rc3.d/S99stop-bootchart -> ../init.d/stop-bootchart
/etc/rc4.d/S99stop-bootchart -> ../init.d/stop-bootchart
/etc/rc5.d/S99stop-bootchart -> ../init.d/stop-bootchart