How to drastically reduce boot and log-into-X time for ext4 file systems using the e4rat range of tools.
e4rat stands for e4 'reduced access time' and is a project by Andreas Rid and Gundolf Kiefer. The e4rat range of tools are comprised of e4rat-collect, e4rat-realloc and e4rat-preload.
If you look at a classical boot chart you will notice that neither disk nor CPU are utilized fully during the boot process. e4rat changes this to make full use of both disk and CPU during boot process and thus reduce boot time drastically. It consists of three stages:
- e4rat-collect - collect files required for booting into X (on my KDE system 2806)
- e4rat-realloc - reallocate files
- e4rat-preload - preload them
Install the following:
Download to your favourite directory and unpack. Enter that directory and run
cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=release
sudo make install
You should now have the following files:
Getting it to work
Now for the nitty-gritty:
To have e4rat collect a list of files you will need to append the following to your kernel stanza in your /boot/grub/menu.lst (grub legacy) or /boot/grub/grub.cfg (grub2) file:
This will only have to be done once so you may prefer to append this command on the grub command line itself.
Upon booting e4rat-collect will watch your system for a default of 120 seconds. So if boot, log into X, open your favourite browser and email client all within 2 minutes, all those activities are logged. To change the default of 120 seconds edit /etc/e4rat.conf
Upon successful boot and after having waited 120 seconds you should see the following file: /var/lib/e4rat/startup.log
Do not forget to remove the e4rat-collect command from your menu.lst or grub.cfg file (not necessary if you inserted it on the grub command line).
For the reallocation process change to init 1
sudo init 1
Log in as root and run:
This can take a while depending on how many files you have your startup.log file.
Append the following permanently to your kernel stanza in your /boot/grub/menu.lst (grub legacy) or /boot/grub/grub.cfg (grub2) file:
Out of interest
Why don't you install bootchart and have it run before and after e4rat installation and gawk at the difference.