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:

82799

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-01-13
devcontainer - 0.81.0
Ebuild name:

app-containers/devcontainer-0.81.0

Description

Reference implementation of the Development Containers specifica

Added to portage

2026-01-13

dotnet-outdated - 4.6.9
Ebuild name:

dev-dotnet/dotnet-outdated-4.6.9

Description

Display and update outdated NuGet packages in a project

Added to portage

2026-01-13

kdevelop - 25.08.3-r1
Ebuild name:

dev-util/kdevelop-25.08.3-r1

Description

Integrated Development Environment, supporting KF6/Qt, C/C++ and much

Added to portage

2026-01-13

osm - 2.1
Ebuild name:

app-emacs/osm-2.1

Description

OpenStreetMap tile-based viewer for GNU Emacs

Added to portage

2026-01-13

2026-01-12
binary-orphans - 1.0.5
Ebuild name:

dev-haskell/binary-orphans-1.0.5

Description

Compatibility package for binary; provides instances

Added to portage

2026-01-12

bitvec - 1.1.5.0
Ebuild name:

dev-haskell/bitvec-1.1.5.0

Description

Space-efficient bit vectors

Added to portage

2026-01-12

boost - 1.90.0
Ebuild name:

dev-libs/boost-1.90.0

Description

Boost Libraries for C++

Added to portage

2026-01-12

busybox - 1.36.1-r4
Ebuild name:

sys-apps/busybox-1.36.1-r4

Description

Utilities for rescue and embedded systems

Added to portage

2026-01-12

calligraplan - 4.0.1
Ebuild name:

app-office/calligraplan-4.0.1

Description

Project management application

Added to portage

2026-01-12

chell - 0.5.0.2-r1
Ebuild name:

dev-haskell/chell-0.5.0.2-r1

Description

A simple and intuitive library for automated testing

Added to portage

2026-01-12

dalli - 4.0.0
Ebuild name:

dev-ruby/dalli-4.0.0

Description

A high performance pure Ruby client for accessing memcached servers

Added to portage

2026-01-12

darcs - 2.16.5-r6
Ebuild name:

dev-vcs/darcs-2.16.5-r6

Description

a distributed, interactive, smart revision control system

Added to portage

2026-01-12

dulwich - 0.25.2
Ebuild name:

dev-python/dulwich-0.25.2

Description

Pure-Python implementation of the Git file formats and protocols

Added to portage

2026-01-12

fastfetch - 2.57.0
Ebuild name:

app-misc/fastfetch-2.57.0

Description

Fast neofetch-like system information tool

Added to portage

2026-01-12

firefox-bin - 147.0
Ebuild name:

www-client/firefox-bin-147.0

Description

Firefox Web Browser

Added to portage

2026-01-12

gcc - 14.3.1_p20260109
Ebuild name:

sys-devel/gcc-14.3.1_p20260109

Description

The GNU Compiler Collection

Added to portage

2026-01-12

gcc - 15.2.1_p20260110
Ebuild name:

sys-devel/gcc-15.2.1_p20260110

Description

The GNU Compiler Collection

Added to portage

2026-01-12

gcc - 16.0.0_p20260111
Ebuild name:

sys-devel/gcc-16.0.0_p20260111

Description

The GNU Compiler Collection

Added to portage

2026-01-12

git - 4.2.0
Ebuild name:

dev-ruby/git-4.2.0

Description

Library for using Git in Ruby

Added to portage

2026-01-12

git-sources - 6.19_rc5
Ebuild name:

sys-kernel/git-sources-6.19_rc5

Description

The very latest -git version of the Linux kernel

Added to portage

2026-01-12

hishel - 1.1.8
Ebuild name:

dev-python/hishel-1.1.8

Description

An elegant HTTP Cache implementation for HTTPX and HTTP Core

Added to portage

2026-01-12

hypothesis - 6.150.1
Ebuild name:

dev-python/hypothesis-6.150.1

Description

A library for property based testing

Added to portage

2026-01-12

ig - 0.48.0
Ebuild name:

app-admin/ig-0.48.0

Description

Tools and framework for data collection and system inspection using eBPF

Added to portage

2026-01-12

inkscape - 1.4.3
Ebuild name:

media-gfx/inkscape-1.4.3

Description

SVG based generic vector-drawing program

Added to portage

2026-01-12

jupyterlab - 4.5.2
Ebuild name:

dev-python/jupyterlab-4.5.2

Description

JupyterLab computational environment

Added to portage

2026-01-12

kdevelop - 25.12.1-r1
Ebuild name:

dev-util/kdevelop-25.12.1-r1

Description

Integrated Development Environment, supporting KF6/Qt, C/C++ and much

Added to portage

2026-01-12

kube-apiserver - 1.34.3
Ebuild name:

sys-cluster/kube-apiserver-1.34.3

Description

Kubernetes API server

Added to portage

2026-01-12

kube-controller-manager - 1.34.3
Ebuild name:

sys-cluster/kube-controller-manager-1.34.3

Description

Kubernetes Controller Manager

Added to portage

2026-01-12

kube-proxy - 1.34.3
Ebuild name:

sys-cluster/kube-proxy-1.34.3

Description

Kubernetes Proxy service

Added to portage

2026-01-12

kube-scheduler - 1.34.3
Ebuild name:

sys-cluster/kube-scheduler-1.34.3

Description

Kubernetes Scheduler

Added to portage

2026-01-12

kubeadm - 1.34.3
Ebuild name:

sys-cluster/kubeadm-1.34.3

Description

CLI to Easily bootstrap a secure Kubernetes cluster

Added to portage

2026-01-12

kubectl - 1.34.3
Ebuild name:

sys-cluster/kubectl-1.34.3

Description

CLI to run commands against Kubernetes clusters

Added to portage

2026-01-12

kubelet - 1.34.3
Ebuild name:

sys-cluster/kubelet-1.34.3

Description

Kubernetes Node Agent

Added to portage

2026-01-12

leancheck - 1.0.4
Ebuild name:

dev-haskell/leancheck-1.0.4

Description

Enumerative property-based testing

Added to portage

2026-01-12

lego - 4.31.0
Ebuild name:

app-crypt/lego-4.31.0

Description

Let's Encrypt/ACME client (like certbot or acme.sh) and library written in Go

Added to portage

2026-01-12

libtasn1 - 4.21.0
Ebuild name:

dev-libs/libtasn1-4.21.0

Description

ASN.1 library

Added to portage

2026-01-12

linux-firmware - 20260110
Ebuild name:

sys-kernel/linux-firmware-20260110

Description

Linux firmware files

Added to portage

2026-01-12

localhost - 1.7.0
Ebuild name:

dev-ruby/localhost-1.7.0

Description

Manage a local CA for self-signed localhost development servers

Added to portage

2026-01-12

notebook - 7.5.2
Ebuild name:

dev-python/notebook-7.5.2

Description

Jupyter Interactive Notebook

Added to portage

2026-01-12

onetuple - 0.4.2.1
Ebuild name:

dev-haskell/onetuple-0.4.2.1

Description

Singleton Tuple

Added to portage

2026-01-12

openpgp-keys-gentoo-developers - 20260105
Ebuild name:

sec-keys/openpgp-keys-gentoo-developers-20260105

Description

Gentoo Authority Keys (GLEP 79)

Added to portage

2026-01-12

openpgp-keys-libtasn1 - 20260112
Ebuild name:

sec-keys/openpgp-keys-libtasn1-20260112

Description

OpenPGP keys used by GNU Libtasn1

Added to portage

2026-01-12

pcsx2 - 2.6.2
Ebuild name:

games-emulation/pcsx2-2.6.2

Description

PlayStation 2 emulator

Added to portage

2026-01-12

regex-base - 0.94.0.3
Ebuild name:

dev-haskell/regex-base-0.94.0.3

Description

Common

Added to portage

2026-01-12

regex-posix - 0.96.0.2
Ebuild name:

dev-haskell/regex-posix-0.96.0.2

Description

POSIX Backend for

Added to portage

2026-01-12

regex-tdfa - 1.3.2.5
Ebuild name:

dev-haskell/regex-tdfa-1.3.2.5

Description

Pure Haskell Tagged DFA Backend for

Added to portage

2026-01-12

ruby-cairo-gobject - 4.3.4
Ebuild name:

dev-ruby/ruby-cairo-gobject-4.3.4

Description

Ruby cairo-gobject bindings

Added to portage

2026-01-12

ruby-gio2 - 4.3.4-r1
Ebuild name:

dev-ruby/ruby-gio2-4.3.4-r1

Description

Ruby binding of gio-2

Added to portage

2026-01-12

ruby-glib2 - 4.3.4-r1
Ebuild name:

dev-ruby/ruby-glib2-4.3.4-r1

Description

Ruby Glib2 bindings

Added to portage

2026-01-12

ruby-gobject-introspection - 4.3.4-r1
Ebuild name:

dev-ruby/ruby-gobject-introspection-4.3.4-r1

Description

Ruby GObjectIntrospection bindings

Added to portage

2026-01-12

ruby-poppler - 4.3.4
Ebuild name:

dev-ruby/ruby-poppler-4.3.4

Description

Ruby poppler-glib bindings

Added to portage

2026-01-12

ruff - 0.14.11
Ebuild name:

dev-util/ruff-0.14.11

Description

An extremely fast Python linter, written in Rust

Added to portage

2026-01-12

scdrand - 0.3.5
Ebuild name:

app-crypt/scdrand-0.3.5

Description

Feed kernel entropy pool from smartcard's TRNG

Added to portage

2026-01-12

subrandr - 1.1.0
Ebuild name:

media-libs/subrandr-1.1.0

Description

Subtitle rendering library for rendering non-ASS subtitles

Added to portage

2026-01-12

system-fileio - 0.3.16.7
Ebuild name:

dev-haskell/system-fileio-0.3.16.7

Description

Consistent filesystem interaction across GHC versions (deprecate

Added to portage

2026-01-12

systemd - 259
Ebuild name:

sys-apps/systemd-259

Description

System and service manager for Linux

Added to portage

2026-01-12

telegram-desktop - 6.4.2
Ebuild name:

net-im/telegram-desktop-6.4.2

Description

Official desktop client for Telegram

Added to portage

2026-01-12

telegram-desktop-bin - 6.4.2
Ebuild name:

net-im/telegram-desktop-bin-6.4.2

Description

Official desktop client for Telegram (binary package)

Added to portage

2026-01-12

test-framework - 0.8.2.3
Ebuild name:

dev-haskell/test-framework-0.8.2.3

Description

Framework for running and organising tests, with HUnit and Quick

Added to portage

2026-01-12

test-framework-hunit - 0.3.0.3
Ebuild name:

dev-haskell/test-framework-hunit-0.3.0.3

Description

HUnit support for the test-framework package

Added to portage

2026-01-12

test-framework-leancheck - 0.0.4
Ebuild name:

dev-haskell/test-framework-leancheck-0.0.4

Description

LeanCheck support for test-framework

Added to portage

2026-01-12

test-framework-quickcheck2 - 0.3.0.7
Ebuild name:

dev-haskell/test-framework-quickcheck2-0.3.0.7

Description

QuickCheck-2 support for the test-framework package

Added to portage

2026-01-12

trove-classifiers - 2026.1.12.15
Ebuild name:

dev-python/trove-classifiers-2026.1.12.15

Description

Canonical source for classifiers on PyPI (pypi.org)

Added to portage

2026-01-12

unifont - 17.0.03
Ebuild name:

media-fonts/unifont-17.0.03

Description

GNU Unifont - a Pan-Unicode X11 bitmap iso10646 font

Added to portage

2026-01-12

whenever - 0.9.5
Ebuild name:

dev-python/whenever-0.9.5

Description

Modern datetime library for Python

Added to portage

2026-01-12

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