Difference between revisions of "E4rat"

From ArchWiki
Jump to: navigation, search
(Who benefits, who doesn't: remove FUD)
(several style fixes, see Help:Style)
Line 25: Line 25:
 
* '''e4rat-preload''' - preload them
 
* '''e4rat-preload''' - preload them
  
===Who benefits, who doesn't===
+
===Who benefits, who does not===
  
 
e4rat has proven to be extremely effective for typical single user set-ups which boot straight into X, perhaps even with a number of programs open. If you have a server set-up and boot only into the CLI your boot time decrease may not be as drastic. Users of SSD drives do not benefit because there are no moving parts and thus (almost) no disk latency - [[Ureadahead]] might be worth looking at.
 
e4rat has proven to be extremely effective for typical single user set-ups which boot straight into X, perhaps even with a number of programs open. If you have a server set-up and boot only into the CLI your boot time decrease may not be as drastic. Users of SSD drives do not benefit because there are no moving parts and thus (almost) no disk latency - [[Ureadahead]] might be worth looking at.
  
'''Note to ureadahead users:''' The [http://e4rat.sourceforge.net/wiki/index.php/Main_Page#Ubuntu_and_ureadahead official e4rat manual] states that ureadahead conflicts with e4rat. This may be true for Ubuntu but using e4rat in conjunction with ureadahead does work on Arch Linux, although it does not speed up the boot process any further.  
+
{{Note|'''(to ureadahead users)''' The [http://e4rat.sourceforge.net/wiki/index.php/Main_Page#Ubuntu_and_ureadahead official e4rat manual] states that ureadahead conflicts with e4rat. This may be true for Ubuntu but using e4rat in conjunction with ureadahead does work on Arch Linux, although it does not speed up the boot process any further.}}
  
It's always better to be safe than sorry. Just make backup if you can't afford to lose data on your partition.
+
It is always better to be safe than sorry. Just make backup if you cannot afford to lose data on your partition.
  
 
==Installation==
 
==Installation==
The {{Pkg|e4rat}} package can be found in the [community] repository:
+
[[pacman|Install]] {{Pkg|e4rat}} from the [[Official Repositories]].
# pacman -S e4rat
+
  
 
==Getting it to work==
 
==Getting it to work==
Line 42: Line 41:
 
To have e4rat collect a list of files you will need to append the following to your linux line in your '''/boot/grub/menu.lst''' (grub legacy) or '''/boot/grub/grub.cfg''' (grub2) file:
 
To have e4rat collect a list of files you will need to append the following to your linux line in your '''/boot/grub/menu.lst''' (grub legacy) or '''/boot/grub/grub.cfg''' (grub2) file:
  
<pre>init=/sbin/e4rat-collect</pre>
+
{{bc|1=init=/sbin/e4rat-collect}}
  
 
This will only have to be done once so you may prefer to append this command on the grub command line itself.
 
This will only have to be done once so you may prefer to append this command on the grub command line itself.
Line 48: Line 47:
 
Upon booting e4rat-collect will watch your system for a default of 120 seconds. So if you boot, log into X, open your favourite browser and email client all within 2 minutes, every one of those activities is logged. To change the default of 120 seconds edit '''/etc/e4rat.conf'''. To manually stop e4rat-collect type:
 
Upon booting e4rat-collect will watch your system for a default of 120 seconds. So if you boot, log into X, open your favourite browser and email client all within 2 minutes, every one of those activities is logged. To change the default of 120 seconds edit '''/etc/e4rat.conf'''. To manually stop e4rat-collect type:
  
<pre>e4rat-collect -k</pre>or<pre>pkill e4rat-collect</pre>
+
{{bc|e4rat-collect -k}}or{{bc|pkill e4rat-collect}}
  
 
Upon successful boot and after having waited the allotted time you should see the following file: '''/var/lib/e4rat/startup.log'''
 
Upon successful boot and after having waited the allotted time you should see the following file: '''/var/lib/e4rat/startup.log'''
Line 56: Line 55:
 
===e4rat-realloc===
 
===e4rat-realloc===
 
For the reallocation process change to init 1
 
For the reallocation process change to init 1
<pre>sudo init 1</pre>
+
{{bc|sudo init 1}}
 
Log in as root and run:
 
Log in as root and run:
<pre>e4rat-realloc  /var/lib/e4rat/startup.log</pre>
+
{{bc|e4rat-realloc  /var/lib/e4rat/startup.log}}
 
This can take a while depending on how many files you have in your startup.log file.
 
This can take a while depending on how many files you have in your startup.log file.
 
===e4rat-preload===
 
===e4rat-preload===
 
Append the following permanently to your kernel line in your '''/boot/grub/menu.lst''' (grub legacy) or '''/boot/grub/grub.cfg''' (grub2) file:
 
Append the following permanently to your kernel line in your '''/boot/grub/menu.lst''' (grub legacy) or '''/boot/grub/grub.cfg''' (grub2) file:
  
<pre>init=/sbin/e4rat-preload</pre>
+
{{bc|1=init=/sbin/e4rat-preload}}
  
:{{Note|1=If you are using grub2, kernel parameters are added in {{Ic|/etc/default/grub}} - {{Ic|1=GRUB_CMDLINE_LINUX="..."}}}}
+
{{Note|1=If you are using grub2, kernel parameters are added in {{Ic|/etc/default/grub}} - {{Ic|1=GRUB_CMDLINE_LINUX="..."}}}}
  
 
===Alternative: e4rat-preload-lite===
 
===Alternative: e4rat-preload-lite===
Line 79: Line 78:
 
Append (or replace) the following permanently to your kernel line in your '''/boot/grub/menu.lst''' (grub legacy) or '''/boot/grub/grub.cfg''' (grub2) file:
 
Append (or replace) the following permanently to your kernel line in your '''/boot/grub/menu.lst''' (grub legacy) or '''/boot/grub/grub.cfg''' (grub2) file:
  
<pre>init=/usr/sbin/e4rat-preload-lite</pre>
+
{{bc|1=init=/usr/sbin/e4rat-preload-lite}}
  
 
Reboot and enjoy.
 
Reboot and enjoy.
Line 88: Line 87:
 
==Bootchart==
 
==Bootchart==
  
<b>Note: this hasn't worked for and is still in development - any suggestions welcome</b>
+
<b>Note: this has not worked for and is still in development - any suggestions welcome</b>
  
 
You will see a noticeable improvement but nothing can beat a nice [[Bootchart]]. Have it run before and after e4rat installation and gawk at the difference.
 
You will see a noticeable improvement but nothing can beat a nice [[Bootchart]]. Have it run before and after e4rat installation and gawk at the difference.
Line 94: Line 93:
 
===bootchart 0.9-9===
 
===bootchart 0.9-9===
  
This version automatically stops logging as soon as ?dm comes up. Supposedly the following overrides that and continues logging but it doesn't work for me:
+
This version automatically stops logging as soon as ?dm comes up. Supposedly the following overrides that and continues logging but it does not work for me:
  
 
To continue logging adjust your '''/etc/bootchartd.conf''' as follows:
 
To continue logging adjust your '''/etc/bootchartd.conf''' as follows:
  
<pre>AUTO_STOP_LOGGER="no"</pre>
+
{{bc|1=AUTO_STOP_LOGGER="no"}}
  
 
To stop it manually type:
 
To stop it manually type:
  
<pre>~# bootchartd stop</pre>
+
{{bc|~# bootchartd stop}}
  
 
To run both e4rat-preload and bootchart append the following to your grub kernel line:
 
To run both e4rat-preload and bootchart append the following to your grub kernel line:
  
<pre>init=/sbin/bootchartd bootchart_init=/sbin/e4rat-preload</pre>
+
{{bc|1=init=/sbin/bootchartd bootchart_init=/sbin/e4rat-preload}}
  
 
===bootchart2===
 
===bootchart2===
Line 137: Line 136:
  
 
*this suggests that you have /var on a separate partition which is not yet mounted during boot. You need move your '''startup.log''' to an accessible partition (/etc/e4rat/ is just fine) and adjust your '''/etc/e4rat.conf''' to reflect this change:
 
*this suggests that you have /var on a separate partition which is not yet mounted during boot. You need move your '''startup.log''' to an accessible partition (/etc/e4rat/ is just fine) and adjust your '''/etc/e4rat.conf''' to reflect this change:
<pre>startup_log_file /etc/e4rat/startup.log</pre>
+
{{bc|startup_log_file /etc/e4rat/startup.log}}

Revision as of 11:26, 14 May 2012

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.


Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어


External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

Template:Article summary start Template:Article summary text Template:Article summary heading Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary heading Template:Article summary link Template:Article summary link Template:Article summary end

e4rat stands for e4 'reduced access time' (ext4 file system only) 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.

Current version is 0.2.1

Process

If you look at a classical bootchart 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 for a specified time (default 120 seconds but this can be adjusted)
  • e4rat-realloc - reallocate files
  • e4rat-preload - preload them

Who benefits, who does not

e4rat has proven to be extremely effective for typical single user set-ups which boot straight into X, perhaps even with a number of programs open. If you have a server set-up and boot only into the CLI your boot time decrease may not be as drastic. Users of SSD drives do not benefit because there are no moving parts and thus (almost) no disk latency - Ureadahead might be worth looking at.

Note: (to ureadahead users) The official e4rat manual states that ureadahead conflicts with e4rat. This may be true for Ubuntu but using e4rat in conjunction with ureadahead does work on Arch Linux, although it does not speed up the boot process any further.

It is always better to be safe than sorry. Just make backup if you cannot afford to lose data on your partition.

Installation

Install e4rat from the Official Repositories.

Getting it to work

Now for the nitty-gritty:

e4rat-collect

To have e4rat collect a list of files you will need to append the following to your linux line in your /boot/grub/menu.lst (grub legacy) or /boot/grub/grub.cfg (grub2) file:

init=/sbin/e4rat-collect

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 you boot, log into X, open your favourite browser and email client all within 2 minutes, every one of those activities is logged. To change the default of 120 seconds edit /etc/e4rat.conf. To manually stop e4rat-collect type:

e4rat-collect -k
or
pkill e4rat-collect

Upon successful boot and after having waited the allotted time 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).

e4rat-realloc

For the reallocation process change to init 1

sudo init 1

Log in as root and run:

e4rat-realloc  /var/lib/e4rat/startup.log

This can take a while depending on how many files you have in your startup.log file.

e4rat-preload

Append the following permanently to your kernel line in your /boot/grub/menu.lst (grub legacy) or /boot/grub/grub.cfg (grub2) file:

init=/sbin/e4rat-preload
Note: If you are using grub2, kernel parameters are added in /etc/default/grub - GRUB_CMDLINE_LINUX="..."

Alternative: e4rat-preload-lite

An alternative preload binary has been developed by jlindgren, it shaves a few extra seconds from your boot time.

The savings come from

  • using pure C with no external library dependencies, which drops the number of linked .so files from 22 to 3

Note: Current [0.2.2] version of e4rat-preload is linked against 5 .so libraries, including libc, libm, libpthread ! So there is not much of a difference here !

  • preloading only the first 100 files (both inodes and file contents) before starting /sbin/init, then continuing to load the remaining files in parallel with the normal boot sequence.

You can install e4rat-preload-liteAUR from the AUR.

Append (or replace) the following permanently to your kernel line in your /boot/grub/menu.lst (grub legacy) or /boot/grub/grub.cfg (grub2) file:

init=/usr/sbin/e4rat-preload-lite

Reboot and enjoy.

e4rat with different init system

e4rat-collect defaults to replacing itself with /sbin/init upon completion. If you need to specify another PID 1, such as /bin/systemd, you can change this in /etc/e4rat.conf by setting the init parameter and uncommenting the line.

Bootchart

Note: this has not worked for and is still in development - any suggestions welcome

You will see a noticeable improvement but nothing can beat a nice Bootchart. Have it run before and after e4rat installation and gawk at the difference.

bootchart 0.9-9

This version automatically stops logging as soon as ?dm comes up. Supposedly the following overrides that and continues logging but it does not work for me:

To continue logging adjust your /etc/bootchartd.conf as follows:

AUTO_STOP_LOGGER="no"

To stop it manually type:

~# bootchartd stop

To run both e4rat-preload and bootchart append the following to your grub kernel line:

init=/sbin/bootchartd bootchart_init=/sbin/e4rat-preload

bootchart2

To get bootchart2 working together with e4rat edit /sbin/bootchartd and replace the line init="/sbin/init" with "init="/sbin/e4rat-preload".

/etc/bootchartd.conf of bootchart2 is set up differently and the line

EXIT_PROC="kdm_greet xterm konsole gnome-terminal metacity mutter compiz ldm icewm-session enlightenment"

can be adjusted or left empty for logging to be stopped manually rather than at a predetermined programme start.

Troubleshooting

If things do not work you may want to try the following.

startup.log is not created

  • comment out auditd from your rc.conf
  • check the following for any hints
dmesg | grep e4rat
  • try to increase verbosity and loglevel to 31 in your e4rat.conf

e4rat erroneously reports an ext2 files system

  • add the following to the kernel line in your grub.cfg or menu.lst
rootfstype=ext4

/var/lib/e4rat/startup.log is not accessible

  • this suggests that you have /var on a separate partition which is not yet mounted during boot. You need move your startup.log to an accessible partition (/etc/e4rat/ is just fine) and adjust your /etc/e4rat.conf to reflect this change:
startup_log_file /etc/e4rat/startup.log