Difference between revisions of "Ureadahead"

From ArchWiki
Jump to: navigation, search
m (Configuration)
(More resources)
(26 intermediate revisions by 9 users not shown)
Line 1: Line 1:
Ureadahead (Über-readahead) is used to speed up the boot process. It works by reading all the files required during boot and makes pack files for quicker access, then during boot reads these files in advance, thus minimizes the access times for the harddrives.
+
[[Category:Boot process]]
 +
Ureadahead (Über-readahead) is used to speed up the boot process. It works by reading all the files required during boot and makes pack files for quicker access, then during boot reads these files in advance, thus minimizes the access times for the harddrives. It's intended to replace sreadahead.
  
 
== Requirements ==
 
== Requirements ==
Currently, ureadahead needs a kernel patch to work. This is provided by ying in the [http://aur.archlinux.org/packages.php?ID=37895 AUR].
+
Currently, ureadahead needs a kernel patch to work. You can use {{AUR|linux-ureadahead}}.
  
Ureadahead is also [http://aur.archlinux.org/packages.php?ID=37889 available], of course.
+
The user-space package is called {{AUR|ureadahead}}.
  
 
== How it works ==
 
== How it works ==
When run without any arguments, ureadahead checks for pack files in /var/lib/ureadahead, and if  none are found or if the packfiles are older than a month, it starts tracing the boot process. When it's tracing, it waits for either a TERM or INT signal before generating the pack file.
+
When run without any arguments, ureadahead checks for pack files in /var/lib/ureadahead, and if  none are found or if the packfiles are older than a month, it starts tracing the boot process. When tracing, it waits for either a TERM or INT signal before generating the pack file.
  
 
Otherwise, if the file is up to date, it just reads the pack file in preparation for the boot.
 
Otherwise, if the file is up to date, it just reads the pack file in preparation for the boot.
Line 14: Line 15:
  
 
== Using ureadahead ==
 
== Using ureadahead ==
First you need the patched kernel. Then you need to generate the pack files by running
+
First you need the patched kernel. After the installation you need to make ureadahead start on boot. Simply create the file {{ic|/etc/rc.d/functions.d/ureadahead}} and add:
$ ureadahead --timeout=300
+
This lets ureadahead trace the boot process for 5 minutes before killing the trace and generating the pack files.
+
 
+
When you've generated the packfiles, you need to start ureadahead during boot. Simply create the file /etc/rc.d/functions.d/ureadahead and add
+
 
  ureadahead() {
 
  ureadahead() {
  /sbin/ureadahead --timeout=240
+
  /sbin/ureadahead --timeout=240 &
 
  }
 
  }
 
   
 
   
 
  add_hook sysinit_end ureadahead
 
  add_hook sysinit_end ureadahead
 
to start it after sysinit.  
 
to start it after sysinit.  
{{Note|You can also use sysinit_premount to start it before it mounts all the other filesystems in /etc/fstab, but this might create issues depending on your system (e.g. if you have /var on a separate partition).}}
+
{{Note|You can also use {{ic|sysinit_premount}} to start it before it mounts all the other filesystems in {{ic|/etc/fstab}}, but this might create issues depending on your system (e.g. if you have {{ic|/var}} on a separate partition).}}
  
 
Now you should be good to go.
 
Now you should be good to go.
  
 
== Configuration ==
 
== Configuration ==
There isn't really much in the way of configuring ureadahead. If you want to retrance the boot sequence (After installing new daemons or after upgrading the kernel) you can use
+
There are few configuration options for ureadahead. You can specify which mountpoint to trace with:
$ ureadahead --timeout=300 --force-trace
+
{{bc|$ ureadahead /<mountpoint>}}
 +
though it should automatically trace all needed mountpoints during boot.
  
It can also be called with  
+
You can also run it with {{Ic|--force-trace}} to force a retrace, however it is better to remove the pack files and reboot.
$ ureadahead /<mountpoint>
+
 
to generate a packfile for that particular mountpoint. This is useful if you have /usr or /var on separate partitions and only want to update those pack files. Combine it with --timeout to automatically kill the tracing, or just use ^C.
+
The pack files are in {{ic|/var/lib/ureadahead}} and are named after their mountpoint (i.e. {{ic|pack}} for root, {{ic|home.pack}} for {{ic|/home}}).
  
 
== Questions ==
 
== Questions ==
 
{{FAQ
 
{{FAQ
 
|question=Why does this take so long time tracing?
 
|question=Why does this take so long time tracing?
|answer=If you didn't supply --timeout, you need to kill it manually. Either just ^C it, or use pkill ureadahead.}}
+
|answer=If you didn't supply --timeout, you need to kill it manually. Either just {{Keypress|^C}} it, or use {{ic|pkill ureadahead}}.}}
{{FAQ
+
|question=This didn't make my boot any faster!
+
|answer=Did you forget to generate the pack files? If you did, ureadahead will try to generate them on boot, which will take a while.}}
+
  
 
== Helping out ==
 
== Helping out ==
 
If your boot actually becomes slower after generating the pack files and you're sure ureadahead is to blame, then file a bug report. To get useful data, make sure both ureadahead and bootchart installed.
 
If your boot actually becomes slower after generating the pack files and you're sure ureadahead is to blame, then file a bug report. To get useful data, make sure both ureadahead and bootchart installed.
  
First, disable ureadahead on boot (remove /etc/rc.d/functions.d/ureadahead) and remove the pack files in /var/lib/ureadahead, then reboot and save the bootchart.
+
First, disable ureadahead on boot (remove {{ic|/etc/rc.d/functions.d/ureadahead}}) and remove the pack files in {{ic|/var/lib/ureadahead}}, then reboot and save the bootchart.
  
Then, reenable ureadahead (recreate the file in /etc/rc.d/functions.d/ureadahead) and reboot. Save this bootchart too.
+
Then, reenable ureadahead (recreate the file in {{ic|/etc/rc.d/functions.d/ureadahead}}) and reboot. Save this bootchart too.
  
 
Finally, reboot once more, and save the final bootchart.
 
Finally, reboot once more, and save the final bootchart.
  
Now you should have 3 bootcharts, one without ureadahead, one when ureadahead is tracing and one when it's running normally. Then, as root, run
+
Now you should have 3 bootcharts, one without ureadahead, one when ureadahead is tracing and one when it's running normally. Then, as root, run:
$ ureadahead --dump > ureadahead.dump
+
{{bc|# ureadahead --dump > ureadahead.dump}}
 
to dump the contents of the pack file. Create a bug report on the ureadahead launchpad file and attach the bootcharts along with the dump.
 
to dump the contents of the pack file. Create a bug report on the ureadahead launchpad file and attach the bootcharts along with the dump.
{{Note|I don't know how welcome this will be to the ubuntu developers, since we're using arch. If you still want to help, give it a try and see if they're interested.}}
+
{{Note|I do not know how welcome this will be to the ubuntu developers, since we're using arch. If you still want to help, give it a try and see if they're interested.}}
  
 
== More resources ==
 
== More resources ==
[https://launchpad.net/ubuntu/+source/ureadahead ureadahead homepage]
+
*[https://launchpad.net/ubuntu/+source/ureadahead ureadahead homepage]
 
+
*[https://aur.archlinux.org/packages.php?ID=37889 ureadahead package on AUR]
[http://aur.archlinux.org/packages.php?ID=37889 ureadahead package on AUR]
+
*[https://aur.archlinux.org/packages.php?ID=37948 Nvidia driver for the patched kernel]
 
+
[http://aur.archlinux.org/packages.php?ID=37895 patched kernel26 on AUR]
+
 
+
[http://aur.archlinux.org/packages.php?ID=37948 Nvidia driver for the patched kernel]
+
 
+
[http://aur.archlinux.org/packages/kernel26-yi/kernel26-yi/0001-trace-add-trace-events-for-open-exec-an.patch kernel patch for compiling your own kernel]
+

Revision as of 19:09, 26 September 2012

Ureadahead (Über-readahead) is used to speed up the boot process. It works by reading all the files required during boot and makes pack files for quicker access, then during boot reads these files in advance, thus minimizes the access times for the harddrives. It's intended to replace sreadahead.

Requirements

Currently, ureadahead needs a kernel patch to work. You can use linux-ureadaheadAUR.

The user-space package is called ureadaheadAUR.

How it works

When run without any arguments, ureadahead checks for pack files in /var/lib/ureadahead, and if none are found or if the packfiles are older than a month, it starts tracing the boot process. When tracing, it waits for either a TERM or INT signal before generating the pack file.

Otherwise, if the file is up to date, it just reads the pack file in preparation for the boot.

It works for both SSDs and traditional harddrives and automatically optimizes the pack files depending on which you have.

Using ureadahead

First you need the patched kernel. After the installation you need to make ureadahead start on boot. Simply create the file /etc/rc.d/functions.d/ureadahead and add:

ureadahead() {
/sbin/ureadahead --timeout=240 &
}

add_hook sysinit_end ureadahead

to start it after sysinit.

Note: You can also use sysinit_premount to start it before it mounts all the other filesystems in /etc/fstab, but this might create issues depending on your system (e.g. if you have /var on a separate partition).

Now you should be good to go.

Configuration

There are few configuration options for ureadahead. You can specify which mountpoint to trace with:

$ ureadahead /<mountpoint>

though it should automatically trace all needed mountpoints during boot.

You can also run it with --force-trace to force a retrace, however it is better to remove the pack files and reboot.

The pack files are in /var/lib/ureadahead and are named after their mountpoint (i.e. pack for root, home.pack for /home).

Questions

Template:FAQ

Helping out

If your boot actually becomes slower after generating the pack files and you're sure ureadahead is to blame, then file a bug report. To get useful data, make sure both ureadahead and bootchart installed.

First, disable ureadahead on boot (remove /etc/rc.d/functions.d/ureadahead) and remove the pack files in /var/lib/ureadahead, then reboot and save the bootchart.

Then, reenable ureadahead (recreate the file in /etc/rc.d/functions.d/ureadahead) and reboot. Save this bootchart too.

Finally, reboot once more, and save the final bootchart.

Now you should have 3 bootcharts, one without ureadahead, one when ureadahead is tracing and one when it's running normally. Then, as root, run:

# ureadahead --dump > ureadahead.dump

to dump the contents of the pack file. Create a bug report on the ureadahead launchpad file and attach the bootcharts along with the dump.

Note: I do not know how welcome this will be to the ubuntu developers, since we're using arch. If you still want to help, give it a try and see if they're interested.

More resources