E4rat (简体中文)

From ArchWiki
Revision as of 15:17, 16 December 2011 by Cuihao (talk | contribs)
Jump to navigation Jump to search

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 heading Template:Article summary link Template:Article summary link Template:Article summary end

e4rat,'Ext4 - Reducing Access Times'(减少ext4访问次数)之略,是一款优化ext4文件系统、加速系统启动的工具。该项目由 Andreas Rid 和 Gundolf Kiefer 发起。e4rat工具系列包含e4rat-collect、e4rat-realloc、e4rat-preload。




  • e4rat-collect - 收集文件,在特定时间(默认120s,可调整)内收集文件信息
  • e4rat-realloc - 文件再分配,在磁盘上整理文件
  • e4rat-preload - 预读取文件




警告: 在转换的ext4文件系统(比如从ext3升级到ext4)上使用目前版本(指0.20)的ext4非常危险,会严重损坏分区。其原因可能是转换并不完全,而e4rat也没有相关检测机制。使用e4rat前,你应当备份磁盘,并重新格式化分区为ext4,然后恢复文件。



$ pacman -S e4rat




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:


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


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).


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 your startup.log file.


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


Alternative: e4rat-preload-lite

An alternative preload binairy 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, and
  • 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:


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.


Note: this hasn't 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 doesn't work for me:

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


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


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.



startup.log 未创建

  • /etc/rc.conf注释掉auditd
  • 检查下列命令的输出:
dmesg | grep e4rat
  • /etc/e4rat.conf设置loglevel31获取详细调试信息。

e4rat 错误地报告文件系统为 ext2

  • 添加如下内容到/boot/grub/grub.cfg启动项的linux行末尾,或/boot/grub/menu.lst启动项的kernel行末尾:

无法读取 startup.log

  • 这说明你的/var和根目录不在同一分区,因而开机时为挂载。可以修改startup.log文件位置(比如{ic|/etc/startup.log}}),方法是修改/etc/e4rat.conf
startup_log_file /etc/e4rat/startup.log