i posted to forum thread, that RedHat, Fedora Core 2 to be exact uses readahead(2) to speed up boot process. http://forums.gentoo.org/viewtopic.php?p=1557335#1557335 so the idea is to have something similiar in gentoo too. Reproducible: Always Steps to Reproduce: 1. 2. 3.
Created attachment 39996 [details] readahead.c, extracted from kernel-utils-2.4-9.1.131.src.rpm it has no copyrights, so i don't know what it's license is. probably same as the whole package has, License: GPL/OSL.
Created attachment 39997 [details] /etc/init.d/readahead_early, add it to 'boot' runlevel. probably should adjust the dependencies, so that it gets invoked as very first thing. (maybe it does, i haven't checked :))
Created attachment 39998 [details] /etc/init.d/readahead, add it to 'default' runlevel. similiar like, readahead_early, but readahead to memory progams that you will most probably execute when you log in (kdm, kde, gnome, mozilla).
Created attachment 39999 [details] /etc/readahead.early.files, original from FC2
Created attachment 40000 [details] /etc/readahead.files, original from FC2
you could perhaps filter out filenames, that don't exist on your system: # a=$(<readahead.early.files ); echo "$a" |xargs ls -1 2>/dev/null > readahead.early.files NOTE: You MUST run it twice, otherwise you will just truncate your filelist :) also, you could grab the files being used by strace: # strace -eopen -ff /etc/init.d/checkfs status 2>&1 | egrep -o 'open\([^)]+\)' |awk -F'"' '{print $2}'|sort -u
Created attachment 40108 [details] script that will strace(1) executed program for open and exec calls it also needs file called 'filter', what files to exclude from list: ^\. ^/dev/ ^/home/ ^/lib/modules/ ^/proc ^/tmp ^/var/lib/init.d/.*-[0-9]+ ^/var/lock/.keep ^/var/tmp ^/etc$ ^/etc/bash_completion ^/etc/profile.d/ ^/usr/kde/3.3/env/ ^/var/log/
Created attachment 40109 [details] script that will put multiple *.log files, produced by grab-open.sh this script also needs patterns to do some filtering: # require full path: ^[^/] ^/var/run/console ^/etc/runlevels/
Created attachment 40110 [details] script that will make filelist for all 'boot' services it stopped working for me for some unknown reason. the straced progams open /dev/vc/1 and keep waiting there. but it did work before...
Created attachment 40111 [details] /etc/readahead.files, for my workstation. could suit for you, and could not.
Created attachment 40112 [details] /etc/readahead.early.files
to test out the readahead setup: 1. compile readahead.c, install it /usr/sbin 2. create /etc/readahead.files and /etc/readahead.early.files 3. save /etc/init.d/00readahead and /etc/init.d/00readahead_early 4. add 00readahead_early to 'boot' runlevel (rc-update add 00readahead_early boot) 5. add 00readahead to 'default' runlevel (rc-update add 00readahead default) measure time and listen your hdd activity :)
Hello people, I want to setup a group to work on gentoo boot process and try some techiniques to speed it up, making it the fastest boot around (it's already the fastest linux boot) and this bugreport will be one of the building blocks. Check it out and join me: http://bugs.gentoo.org/show_bug.cgi?id=69579
Less dangerous Python-script that you can run after a nice boot and put in readahead.files import os fd = os.popen('lsof -F n') list = [] for line in fd: line = line[1:] line = line[:-1] if line[0] == '/' and line[-1] != '/' and line[:4] != '/dev' and line[:5] != '/proc' and line not in list: list.append( line ) print line
here is an alternative implementation of readahead.c http://blog.drinsama.de/erich/en/linux/2004121101-readahead.html and a possibly better way to track down which files to use readhead on: http://blog.drinsama.de/erich/en/linux/2004122502-readahead4.html
Just for giggles I tried setting it up as shown in #12 and ran the python script from #14, so.. I could experience a boot time as "fast" as the Sun Ultra 5 workstations at the uni's. Whow it was slow. Probably the python script makes the file list too big to be loaded in 1GB RAM. After 11 minutes I stopped my stopwatch, had already logged in with gdm by that time, and went to eat some. When I came back readahead was still pounding against the diskcache, this was at around 38 minutes uptime.. So I would recommend against blindly using the list generated with the script from #14 :-P
Tried again, this time I removed the avi files from the list that were apparently open at the time of the lsof capture.. (several 600+ MB files.. doh) Also removed all lines with "/home/" and "kde" in it from readahead.early.files, and the ones with "/tmp/" and "(deleted)" from both readahead lists. Ran with and without readahead and also once without backgrounding the readahead task. As far as I can clock with my stopwatch only the non-backgrounded run improved boottime with about 10s. Next I should try getting the early readahead earlier in the bootprocess. IT currently seems to be one of the last ones started in the 'boot' runlevel. And maybe getting http://www.bootchart.org/ to run so I have more precise readings.
ok, I've assembled a source package that I'm maintaining upstream for this, based off the readahead-list.c from Erich Schubert that I linked to. "emerge sys-apps/readahead-list" to get it. I'd be very greatful for better scripts to generate the list of files for readahead to use. I suggest you consider using the linux accounting to build a list (hack accton very early into /sbin/rc)... I've included scripts of my own design and used them to build the initial dataset I used.
I've emerged readahead-list (on baselayout-1.9.4-r6) and put it into my boot runlevel. It complains about a circular dependency "ibefore" in checkroot and readahead-list. Other than that it doesn't seem to make a differenc, I've tested with bootchart (from www.bootchart.org). Is there anything else I need to do to test this?
bytewise: could you please post up your bootchart graphic results with readahead-list?
Created attachment 54466 [details] bootchart with readahead-list This is in inkscape format - hope that's ok. If not I can repost. Note that the timeline seems to be off somehow, some of the processes start before 0 secons.
Created attachment 54467 [details] bootchart without readahead-list Just for comparison... here the timeline is correct again.
bytewise: thanks, the inkscape files are just svgz which is easy to view. one thing I find strange, is that readahead-list itself isn't in your after view there.
Well I have the impression it's not really running at all... Could you tell me something with respect to my comment #19?
Robert: sorry about the long response time. Check out the new version, it should work fine. The only thing that this bug now remains open for, is for somebody to provide better ways of building the initial lists.
bytewise: did the newer version work? could you post up newer bootchart output? anybody have any requests to keep this bug open?
*** Bug 142338 has been marked as a duplicate of this bug. ***
no response from any users on their graphs or custom readahead input, so I assume there are no problems, and I can close this bug now.