from small one page howto to huge articles all in one place

search text in:




Other .linuxhowtos.org sites: www.linuxhowtos.org
toolsntoys.linuxhowtos.org



Last additions:
How to make X listen on port 6000

How to make X listen on port 6000

words:

34

views:

86471

userrating:

average rating: 1.2 (52 votes) (1=very good 6=terrible)


May, 25th 2007:
April, 26th 2007:
Apr, 10th. 2007:
Druckversion . pdf icon
You are here: Misc

Speeding up the boot process (next generation)

The idea is to preload the useful files into kernel buffer cache before they are needed. Since I/O can happen parallel to the other CPU intensive tasks during bootup, this leads to faster bootup and faster startup time for your chosen applications. Other projects use static lists to preload the files.

This tutorial uses an automated process of generating the "useful" prefetch database.

This is /etc/init.d/my-readahead.
Code:

#!/sbin/runscript
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

depend() {
        before syslog-ng
}

start() {
        ebegin "Starting readahead ROYALE"
        cat /etc/conf.d/* > /dev/null 2>&1 &
        cat /usr/lib/gconv/gconv-modules.cache > /dev/null 2>&1 &
        cat /usr/share/icons/gnome/icon-theme.cache > /dev/null 2>&1 &
        cat /usr/share/icons/hicolor/icon-theme.cache > /dev/null 2>&1 &
        cat `cat /etc/conf.d/sofile-list.load` > /dev/null 2>&1 &
        if [ -f /forcesampler ];then
                /usr/sbin/sample-init-process /etc/conf.d/sofile-list.load &
                rm -f /forcesampler
        fi 
        eend 0
}

stop() {
        eend 0
}

The executable shell script /usr/sbin/sample-init-process:
Code:

 #!/bin/bash
final_db="$1"

# total number of lists to keep in /etc/conf.d/
total_to_keep=4

# total number of samples to make in /forcesampler boot.
# It will take twice this amount of seconds to finish sampling.
total_samples_per_boot=200

# touch empty file if not there
[ ! -f "$final_db" ] && touch "$final_db"

let i=0
while [ "$i" -ne "$total_to_keep" ] ; do
        if [ ! -f "$final_db$i" ] ; then
                break;
        else
                j=$((i+1))
                if [ "$j" = "$total_to_keep" ] ;then
                        j=0
                fi
                if [ -f "$final_db$j" -a "$final_db$i" -nt "$final_db$j" ];then
                        i=$((j))
                        break;
                fi
        fi
        i=$((i+1))
done
if [ "$i" = "$total_to_keep" ] ;then
        i=0
fi

slot="$i"
cp "$final_db" "$final_db$i"

function collect_sample()
{
        lsof | awk '{if ($5=="REG") {if (match($9,".so") || match($9,".conf") \
        || match($9,"/bin/") || match($9,"ttf") || match($9,"libexec")) \
        print $9}}' | sort | uniq >> $1
}

collect_sample /tmp/init_sample1

i=0 
while [ "$i" -ne "$total_samples_per_boot" ] ; do
        collect_sample /tmp/init_sample2
        cat /tmp/init_sample1 /tmp/init_sample2 | sort | uniq > /tmp/init_sample3
        mv /tmp/init_sample3 /tmp/init_sample1
        sleep 1
        i=$((i+1))
done

cat /tmp/init_sample1 "$final_db$slot" | sort | uniq > "$final_db"

rm -f /tmp/init_sample[123]
And then do this:
Code:
chmod +x /usr/sbin/sample-init-process
rc-update add my-readahead default
touch /forcesampler

What you have done is asked my-readahead to create a sampler process which samples what files (fonts, binaries, libraries, configs) are in use, every second. It collects 200 samples (will be busy for at least 10 minutes after boot) and keeps updating the database with a list of useful files.

Once you boot after this the first time, you will probably see a slow down because its collecting samples for use on the next and subsequent boots. Use your system as you normally would. Open firefox, gaim, OO or whatever. Once the sampler script has finished ('ps -aef|grep sample-init-process' will tell you if its running), reboot. Now this and all subsequent boots will be much faster.

If it takes too long for the sample-init-process to finish, reduce the total_samples_per_boot variable in the sampler script to 100 and try again by touching /forcesampler.

In future, whenever you feel like updating the prefetch database, just 'touch /forcesampler' and database will be updated on next reboot.

based on http://forums.gentoo.org/viewtopic-t-478491.html, some script modifications done.

back



Support us on Content Nation

New Packages

- as rdf newsfeed
- as rss newsfeed
- as Atom newsfeed
2026-07-02
asterisk - 20.20.1
Ebuild name:

net-misc/asterisk-20.20.1

Description

Asterisk A Modular Open Source PBX System

Added to portage

2026-07-02

pdns - 5.1.3
Ebuild name:

net-dns/pdns-5.1.3

Description

The PowerDNS Daemon

Added to portage

2026-07-02

systemd - 261.1
Ebuild name:

sys-apps/systemd-261.1

Description

System and service manager for Linux

Added to portage

2026-07-02

2026-07-01
Gtk2 - 1.249.930-r2
Ebuild name:

dev-perl/Gtk2-1.249.930-r2

Description

Perl bindings for GTK2

Added to portage

2026-07-01

X-Osd - 0.700.0-r4
Ebuild name:

dev-perl/X-Osd-0.700.0-r4

Description

Perl glue to libxosd (X OnScreen Display)

Added to portage

2026-07-01

ansible-compat - 26.6.0
Ebuild name:

dev-python/ansible-compat-26.6.0

Description

Contains functions that facilitate working with various versions o

Added to portage

2026-07-01

ast-serialize - 0.6.0
Ebuild name:

dev-python/ast-serialize-0.6.0

Description

Python bindings for mypy AST serialization

Added to portage

2026-07-01

asterisk - 21.12.3
Ebuild name:

net-misc/asterisk-21.12.3

Description

Asterisk A Modular Open Source PBX System

Added to portage

2026-07-01

asterisk - 22.10.1
Ebuild name:

net-misc/asterisk-22.10.1

Description

Asterisk A Modular Open Source PBX System

Added to portage

2026-07-01

asterisk - 23.4.1
Ebuild name:

net-misc/asterisk-23.4.1

Description

Asterisk A Modular Open Source PBX System

Added to portage

2026-07-01

awscli - 1.45.38
Ebuild name:

app-admin/awscli-1.45.38

Description

Universal Command Line Environment for AWS

Added to portage

2026-07-01

beniget - 0.5.0-r1
Ebuild name:

dev-python/beniget-0.5.0-r1

Description

Extract semantic information about static Python code

Added to portage

2026-07-01

boto3 - 1.43.38
Ebuild name:

dev-python/boto3-1.43.38

Description

The AWS SDK for Python

Added to portage

2026-07-01

botocore - 1.43.38
Ebuild name:

dev-python/botocore-1.43.38

Description

Low-level, data-driven core of boto 3

Added to portage

2026-07-01

cloudflare-warp - 2026.6.822.0
Ebuild name:

net-vpn/cloudflare-warp-2026.6.822.0

Description

Cloudflare Warp Client

Added to portage

2026-07-01

cython - 3.2.8
Ebuild name:

dev-python/cython-3.2.8

Description

A Python to C compiler

Added to portage

2026-07-01

diffoscope - 323
Ebuild name:

dev-util/diffoscope-323

Description

Will try to get to the bottom of what makes files or directories different

Added to portage

2026-07-01

discord - 1.0.145
Ebuild name:

net-im/discord-1.0.145

Description

All-in-one voice and text chat for gamers

Added to portage

2026-07-01

dulwich - 1.2.7
Ebuild name:

dev-python/dulwich-1.2.7

Description

Pure-Python implementation of the Git file formats and protocols

Added to portage

2026-07-01

faker - 40.27.0
Ebuild name:

dev-python/faker-40.27.0

Description

A Python package that generates fake data for you

Added to portage

2026-07-01

gallery-dl - 1.32.5
Ebuild name:

net-misc/gallery-dl-1.32.5

Description

Download image galleries and collections from several image hosting site

Added to portage

2026-07-01

giflib - 6.1.3
Ebuild name:

media-libs/giflib-6.1.3

Description

Library to handle, display and manipulate GIF images

Added to portage

2026-07-01

humanize - 4.16.0
Ebuild name:

dev-python/humanize-4.16.0

Description

Common humanization utilities

Added to portage

2026-07-01

joplin-desktop - 3.7.6
Ebuild name:

app-office/joplin-desktop-3.7.6

Description

Secure note taking and to-do app with synchronization capabilities

Added to portage

2026-07-01

knock - 0.8.2
Ebuild name:

net-misc/knock-0.8.2

Description

Simple port-knocking daemon

Added to portage

2026-07-01

kquickimageeditor - 0.6.2.1
Ebuild name:

media-libs/kquickimageeditor-0.6.2.1

Description

QtQuick components providing basic image editing capabilities

Added to portage

2026-07-01

librt - 0.12.0
Ebuild name:

dev-python/librt-0.12.0

Description

Mypyc runtime library

Added to portage

2026-07-01

lyskom-elisp-client - 0.48_p20200226
Ebuild name:

app-emacs/lyskom-elisp-client-0.48_p20200226

Description

Elisp client for the LysKOM conference system

Added to portage

2026-07-01

m-buffer - 0.16.1
Ebuild name:

app-emacs/m-buffer-0.16.1

Description

List Oriented Buffer Operations for Emacs

Added to portage

2026-07-01

nasm - 3.02
Ebuild name:

dev-lang/nasm-3.02

Description

groovy little assembler

Added to portage

2026-07-01

nginx - 1.29.5-r1
Ebuild name:

www-servers/nginx-1.29.5-r1

Description

Added to portage

2026-07-01

nginx - 1.29.7-r2
Ebuild name:

www-servers/nginx-1.29.7-r2

Description

Added to portage

2026-07-01

nginx - 1.30.0-r1
Ebuild name:

www-servers/nginx-1.30.0-r1

Description

Added to portage

2026-07-01

nginx - 1.30.2-r1
Ebuild name:

www-servers/nginx-1.30.2-r1

Description

Added to portage

2026-07-01

nginx - 1.30.3-r1
Ebuild name:

www-servers/nginx-1.30.3-r1

Description

Added to portage

2026-07-01

nginx - 1.31.1-r1
Ebuild name:

www-servers/nginx-1.31.1-r1

Description

Added to portage

2026-07-01

nginx - 1.31.2-r1
Ebuild name:

www-servers/nginx-1.31.2-r1

Description

Added to portage

2026-07-01

octave-kernel - 1.1.0
Ebuild name:

dev-python/octave-kernel-1.1.0

Description

Jupyter kernel for octave

Added to portage

2026-07-01

pixi - 0.71.3
Ebuild name:

dev-util/pixi-0.71.3

Description

A package management and workflow tool

Added to portage

2026-07-01

qmplay2 - 26.06.27
Ebuild name:

media-video/qmplay2-26.06.27

Description

A Qt-based video player, which can play most formats and codecs

Added to portage

2026-07-01

rpds-py - 2026.6.3
Ebuild name:

dev-python/rpds-py-2026.6.3

Description

Python bindings to Rust's persistent data structures (rpds)

Added to portage

2026-07-01

rssguard - 5.2.1
Ebuild name:

net-news/rssguard-5.2.1

Description

Simple (yet powerful) news feed reader

Added to portage

2026-07-01

samba - 4.24.4
Ebuild name:

net-fs/samba-4.24.4

Description

Samba Suite Version 4

Added to portage

2026-07-01

starship - 1.26.0
Ebuild name:

app-shells/starship-1.26.0

Description

The minimal, blazing-fast, and infinitely customizable prompt for any sh

Added to portage

2026-07-01

svxlink - 26.05
Ebuild name:

media-radio/svxlink-26.05

Description

Multi Purpose Voice Services System, including Qtel for EchoLink

Added to portage

2026-07-01

uv - 0.11.26
Ebuild name:

dev-python/uv-0.11.26

Description

A Python package installer and resolver, written in Rust

Added to portage

2026-07-01

uv-build - 0.11.26
Ebuild name:

dev-python/uv-build-0.11.26

Description

PEP517 uv build backend

Added to portage

2026-07-01

xmlschema - 4.3.2
Ebuild name:

dev-python/xmlschema-4.3.2

Description

An XML Schema validator and decoder

Added to portage

2026-07-01

xvfbwrapper - 0.2.25
Ebuild name:

dev-python/xvfbwrapper-0.2.25

Description

Python wrapper for running a display inside X virtual framebuffer

Added to portage

2026-07-01

yices2 - 2.7.0
Ebuild name:

sci-mathematics/yices2-2.7.0

Description

SMT Solver supporting SMT-LIB and Yices specification language

Added to portage

2026-07-01

rdf newsfeed | rss newsfeed | Atom newsfeed
Copyright 2004-2025 Sascha Nitsch Unternehmensberatung GmbH
- Copyright and legal notices -
Time to create this page: 70.8 ms