So… what is ureadahead?

From the first boot in Lucid Lynx, I've seen that while Ubuntu boots, there are some messages displayed in the upper-right, like:

fsck from (...)

init: ureadahead-other main process (...) terminated with status 4

First, i thought it's a bug, i've searched everywhere for a solution, but nobody knew what was the problem. All that i've understood at that time, was that the status 4 isn't an error.. it's normal. The bug is in Upstart because it spits this messages(it's not really a bug since it's left there for debug). In the past days, I finally found someone(username:keybuk) who has written a small tutorial on ubuntuforums about what is ureadahead. So,

In order to boot Ubuntu, we need to read somewhere between 100MB and 200MB of data from the disk and into memory. Unfortunately the slowest part of your otherwise awesome machine is its hard disk -- that's why we want this data into memory in the first place. Hard disks aren't just slow to read data, they're slow to find it as well! So we can lose a time of time during boot just waiting for the hard disk to find the data we need, and then read it into memory. What ureadahead does is figure out what pieces of which files we actually need, and read everything from the disk into memory in one go. By doing it at once we don't need to spend so much time finding everything, and because it's already in memory, we don't waste anywhere near as much time during boot.

Here's made clear another myth... that Linux doesn't need defragmentation. Very false.. Linux keeps the inodes tables from being fragmented, but the actual data is still fragmented and spread all over the hard-disk in random order. This can cause a slow boot, even with ureadahead, because it has to find the data before putting it in memory. How to view how fast is ureadahead? keybuk gives us the following answer:

Make sure you have the bootchart package installed. Remove the ureadahead pack files, and move the /etc/init/ureadahead.conf file to something like ureadahead.disabled. Reboot, login, etc. and wait for the bootchart to appear ("watch status bootchart" until stop/waiting). Now put the ureadahead conf file back, reboot and login again and wait for bootchart to appear. Finally reboot and login once more, and wait for bootchart to appear. You'll now have three bootcharts. One is without ureadahead, one is when ureadahead is profiling, and the final one is with ureadahead behaving normally.

So.. if ureadahead exists with status code 4, it has nothing to do with the fact that you're computer doesn't boot :)