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:

84528

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-04-21
firefox - 150.0
Ebuild name:

www-client/firefox-150.0

Description

Firefox Web Browser

Added to portage

2026-04-21

firefox-l10n - 150.0
Ebuild name:

www-client/firefox-l10n-150.0

Description

Firefox Web Browser's translation files

Added to portage

2026-04-21

git - 2.54.0
Ebuild name:

dev-vcs/git-2.54.0

Description

Stupid content tracker distributed VCS designed for speed and efficiency

Added to portage

2026-04-21

htmlcxx - 0.87-r1
Ebuild name:

dev-cpp/htmlcxx-0.87-r1

Description

A simple non-validating CSS 1 and HTML parser for C++

Added to portage

2026-04-21

radarr-bin - 6.2.0.10390
Ebuild name:

www-apps/radarr-bin-6.2.0.10390

Description

A fork of Sonarr to work with movies a la Couchpotato

Added to portage

2026-04-21

rutorrent - 5.3.0
Ebuild name:

www-apps/rutorrent-5.3.0

Description

ruTorrent is a front-end for the popular Bittorrent client rTorrent

Added to portage

2026-04-21

spectre-meltdown-checker - 26.33.0420460
Ebuild name:

app-admin/spectre-meltdown-checker-26.33.0420460

Description

Spectre & Meltdown vulnerability/mitigation ch

Added to portage

2026-04-21

2026-04-20
amule - 2.3.3-r8
Ebuild name:

net-p2p/amule-2.3.3-r8

Description

aMule, the all-platform eMule p2p client

Added to portage

2026-04-20

bluez-alsa - 4.3.1-r2
Ebuild name:

media-sound/bluez-alsa-4.3.1-r2

Description

Bluetooth Audio ALSA Backend

Added to portage

2026-04-20

coreutils - 9.11
Ebuild name:

sys-apps/coreutils-9.11

Description

Standard GNU utilities (chmod, cp, dd, ls, sort, tr, head, wc, who,...)

Added to portage

2026-04-20

filelock - 3.29.0
Ebuild name:

dev-python/filelock-3.29.0

Description

A platform independent file lock for Python

Added to portage

2026-04-20

firefox-bin - 150.0
Ebuild name:

www-client/firefox-bin-150.0

Description

Firefox Web Browser

Added to portage

2026-04-20

gcc - 16.0.1_p20260419
Ebuild name:

sys-devel/gcc-16.0.1_p20260419

Description

The GNU Compiler Collection

Added to portage

2026-04-20

gentoo-sources - 5.10.253
Ebuild name:

sys-kernel/gentoo-sources-5.10.253

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-04-20

gentoo-sources - 5.15.203
Ebuild name:

sys-kernel/gentoo-sources-5.15.203

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-04-20

gentoo-sources - 6.1.169
Ebuild name:

sys-kernel/gentoo-sources-6.1.169

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-04-20

gentoo-sources - 6.12.82
Ebuild name:

sys-kernel/gentoo-sources-6.12.82

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-04-20

gentoo-sources - 6.18.23
Ebuild name:

sys-kernel/gentoo-sources-6.18.23

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-04-20

gentoo-sources - 6.19.13
Ebuild name:

sys-kernel/gentoo-sources-6.19.13

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-04-20

gentoo-sources - 6.6.135
Ebuild name:

sys-kernel/gentoo-sources-6.6.135

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-04-20

gentoolkit - 0.7.2
Ebuild name:

app-portage/gentoolkit-0.7.2

Description

Collection of administration scripts for Gentoo

Added to portage

2026-04-20

ghostty - 1.3.1
Ebuild name:

x11-terms/ghostty-1.3.1

Description

Fast, feature-rich, and cross-platform terminal emulator

Added to portage

2026-04-20

ghostty-terminfo - 1.3.1
Ebuild name:

x11-terms/ghostty-terminfo-1.3.1

Description

Terminfo for ghostty, a fast, feature-rich, and cross-platform ter

Added to portage

2026-04-20

hash-slinger - 3.5
Ebuild name:

net-dns/hash-slinger-3.5

Description

Various tools to generate DNS records like SSHFP, TLSA, OPENPGPKEY, IPSECK

Added to portage

2026-04-20

img2pdf - 0.6.3
Ebuild name:

media-gfx/img2pdf-0.6.3

Description

Losslessly convert raster images to PDF

Added to portage

2026-04-20

irker - 2.25
Ebuild name:

net-irc/irker-2.25

Description

Submission tools for IRC notifications

Added to portage

2026-04-20

libquo - 1.3.1-r3
Ebuild name:

sys-cluster/libquo-1.3.1-r3

Description

Run-time tuning of process binding policies made easy

Added to portage

2026-04-20

libtmux - 0.55.1
Ebuild name:

dev-python/libtmux-0.55.1

Description

Typed library that provides an ORM wrapper for tmux, a terminal multiplex

Added to portage

2026-04-20

lyx - 2.5.1
Ebuild name:

app-office/lyx-2.5.1

Description

WYSIWYM (What You See Is What You Mean) document processor based on LaTeX

Added to portage

2026-04-20

mate-calc - 1.28.0-r2
Ebuild name:

mate-extra/mate-calc-1.28.0-r2

Description

Calculator for MATE

Added to portage

2026-04-20

md5deep - 4.4
Ebuild name:

app-crypt/md5deep-4.4

Description

Expanded md5sum program with recursive and comparison options

Added to portage

2026-04-20

md6sum - 1.0-r3
Ebuild name:

app-crypt/md6sum-1.0-r3

Description

A C implementation of MD6

Added to portage

2026-04-20

mhash - 0.9.9.9-r4
Ebuild name:

app-crypt/mhash-0.9.9.9-r4

Description

Library providing a uniform interface to a large number of hash algorith

Added to portage

2026-04-20

minisign - 0.12
Ebuild name:

app-crypt/minisign-0.12

Description

Dead simple tool to sign files and verify signatures

Added to portage

2026-04-20

minted - 3.4.0-r1
Ebuild name:

dev-tex/minted-3.4.0-r1

Description

LaTeX package for source code syntax highlighting

Added to portage

2026-04-20

nbxmpp - 7.2.0
Ebuild name:

dev-python/nbxmpp-7.2.0

Description

Python library to use Jabber/XMPP networks in a non-blocking way

Added to portage

2026-04-20

nikola - 8.3.3-r1
Ebuild name:

www-apps/nikola-8.3.3-r1

Description

A static website and blog generator

Added to portage

2026-04-20

pybind11 - 3.0.4
Ebuild name:

dev-python/pybind11-3.0.4

Description

AST-based Python refactoring library

Added to portage

2026-04-20

pygobject - 3.56.2
Ebuild name:

dev-python/pygobject-3.56.2

Description

Python bindings for GObject Introspection

Added to portage

2026-04-20

safeeyes - 3.4.1
Ebuild name:

x11-misc/safeeyes-3.4.1

Description

Linux alternative to EyeLeo

Added to portage

2026-04-20

skopeo - 1.22.2
Ebuild name:

app-containers/skopeo-1.22.2

Description

Work with remote container images registries

Added to portage

2026-04-20

starship - 1.25.0
Ebuild name:

app-shells/starship-1.25.0

Description

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

Added to portage

2026-04-20

testdisk - 7.2-r1
Ebuild name:

app-admin/testdisk-7.2-r1

Description

Checks and undeletes partitions + PhotoRec, signature based recovery tool

Added to portage

2026-04-20

vlc - 4.0.0_pre20260418
Ebuild name:

media-video/vlc-4.0.0_pre20260418

Description

Media player and framework with support for most multimedia files

Added to portage

2026-04-20

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