e4rat, just a notice.

| 分类 Utility  | 标签 e4rat 

Following content comes from Linux Toy.

e4rat ("Ext4 - Reducing Access Times") 是一款将 Ext4 文件系统上文件块优化排序以加快系统和应用程序启动速度的程序。

对于一般的机械硬盘来讲,将需要顺序载入的文件在硬盘上按照顺序存储可以大大减少寻道时间和旋转延迟,e4rat 利用 2.6.31 内核的引入的 EXT4IOCMOVE_EXT 在线碎片整理功能,来完成并行化载入。顺序读取和高缓存命中的结合使用将可以将系统启动时间缩短至原先的三分之一

系统需求:

  • 要求是原生的 Ext4 文件系统,若是从老版本 Ext 升级上来的不可(仅限 0.20 版本)。
  • 需要是传统的机械磁盘,对于 SSD 固态硬盘无效。
  • 内核必须启用 FSIOCFIEMAP(目前默认 Debian 内核未启用)。
  • 需要停用功能类似的 readahead:
    • Ubuntu: dpkg --purge ureadahead ubuntu-minimal
    • Fedora 15+: systemctl disable systemd-readahead-collect.service systemd-readahead-replay.service
  • 和 auditd 服务冲突。

简洁使用步骤:

  1. 如果使用的不是 /sbin/init 的初始化程序的话(比如 upstart 和 systemd),请配置 /etc/e4rat.conf;
  2. 设置 init=/sbin/e4rat-collect 初始化进程,收集系统启动情况,写入到 /var/lib/e4rat/startup.log 文件中(仅需一次);
  3. 依据 /var/lib/e4rat/startup.log 中的内容,在 single 用户模式下重新排序文件位置 e4rat-realloc /var/lib/e4rat/startup.log
  4. init=/sbin/e4rat-preload 永久性的加入 GRUB 的内核引导行中。

具体使用步骤请参照官方 WikiArch Wiki


 

 




Following content comes from: Gentoo Wiki.

E4rat

 

This article explains how to speed up boot with e4rat. e4rat is a tool to speed boot up by first monitoring files used for the boot process, then arraigning the files in an optimized way on the disc. This gives substantial improvements for booting from hard drives (it is of little use for SSDs). e4rat works only with NATIVE ext4 file systems, so partitions used for boot (probably root partition) must be a pure ext4 partition.

Contents

Installation

e4rat is not in the Portage tree, but available in the sunrise overlay. So, if you don't already have it, add the sunrise overlay using layman:

layman -a sunrise

Now emerge e4rat:

emerge -av sys-fs/e4rat

Kernel Configuration

To use e4rat you must enable auditing support in your kernel. If you use genkernel auditing support may already be enable, if not, enable:

Linux Kernel Configuration: Enable auditing support
-> General setup
	[*] Auditing support
        [*]   Enable system-call auditing support

Compile and install your newly configured kernel.

Usage

e4rat has three main components :

  • e4rat-collect - Monitor files, this is run in place of init, from grub, to determine what files should be included in the optimization.
  • e4rat-realloc - Reallocate files, run once files have been determined.
  • e4rat-preload - Preload files, loaded from grub on subsequent boots.

e4rat-collect

Append the following to your kernel line in your grub or grub2 configuration file. Instead of modifying the grub configuration file, you could add the command from the grub command line itself.

init=/usr/sbin/e4rat-collect

When you reboot e4rat-collect will monitor files opened during the first 120 seconds, so boot up and log in as your main user. You could open a file manager or web browser if you wanted. Wait for the two minutes to finish. When e4rat-collect is complete you should have the log file /var/lib/e4rat/startup.log. Remove the modification to grub configuration if you changed it.

Note: It is possible that you will also need to add rw to your kernel line. Otherwise, the root filesystem might be remounted read-write to late in the boot process resulting in a read-only filesystem and preventing the creation of the startup.log file.

e4rat-realloc

Quit any X sessions and log into a root terminal (Ctrl+Alt+1). Change to runlevel 1 :

# init 1

Now run e4rat-realloc :

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

Wait until completion, it could take a while.

e4rat-preload

Now permanently modify your grub configuration by adding :

init=/usr/sbin/e4rat-preload

You should just need to reboot to see the difference.

 

From Arch Wiki:

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.

 


上一篇     下一篇