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:

83173

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-02-10
algol68g - 3.10.10
Ebuild name:

dev-lang/algol68g-3.10.10

Description

Algol 68 Genie compiler-interpreter

Added to portage

2026-02-10

amdgpu_top - 0.11.2
Ebuild name:

sys-apps/amdgpu_top-0.11.2

Description

Tool to display AMDGPU usage.

Added to portage

2026-02-10

bcel - 6.11.0
Ebuild name:

dev-java/bcel-6.11.0

Description

Apache Commons Bytecode Engineering Library

Added to portage

2026-02-10

calligra - 25.12.2
Ebuild name:

app-office/calligra-25.12.2

Description

KDE Office Suite

Added to portage

2026-02-10

closure-compiler-bin - 20260128
Ebuild name:

dev-lang/closure-compiler-bin-20260128

Description

JavaScript optimizing compiler

Added to portage

2026-02-10

commons-daemon - 1.5.1
Ebuild name:

dev-java/commons-daemon-1.5.1

Description

Tools to allow Java programs to run as UNIX daemons

Added to portage

2026-02-10

devcontainer - 0.83.0
Ebuild name:

app-containers/devcontainer-0.83.0

Description

Reference implementation of the Development Containers specifica

Added to portage

2026-02-10

gallery-dl - 1.31.6
Ebuild name:

net-misc/gallery-dl-1.31.6

Description

Download image galleries and collections from several image hosting site

Added to portage

2026-02-10

kotlin-bin - 2.3.10
Ebuild name:

dev-lang/kotlin-bin-2.3.10

Description

Statically typed language that targets the JVM and JavaScript

Added to portage

2026-02-10

kphotoalbum - 6.1.0-r1
Ebuild name:

media-gfx/kphotoalbum-6.1.0-r1

Description

Tool for indexing, searching, and viewing images

Added to portage

2026-02-10

ktorrent - 25.12.2-r1
Ebuild name:

net-p2p/ktorrent-25.12.2-r1

Description

Powerful BitTorrent client based on KDE Frameworks

Added to portage

2026-02-10

nxml-docbook5-schemas - 5.1
Ebuild name:

app-emacs/nxml-docbook5-schemas-5.1

Description

Add support for DocBook 5 schemas to NXML

Added to portage

2026-02-10

nxml-gentoo-schemas - 20241116
Ebuild name:

app-emacs/nxml-gentoo-schemas-20241116

Description

Extension for nxml-mode with Gentoo-specific schemas

Added to portage

2026-02-10

pdns-recursor - 5.3.5
Ebuild name:

net-dns/pdns-recursor-5.3.5

Description

The PowerDNS Recursor

Added to portage

2026-02-10

recordmydesktop - 0.4.0-r2
Ebuild name:

media-video/recordmydesktop-0.4.0-r2

Description

Desktop session recorder producing Ogg video/audio files

Added to portage

2026-02-10

s2geometry - 0.13.1-r2
Ebuild name:

sci-geosciences/s2geometry-0.13.1-r2

Description

Computational geometry and spatial indexing on the sphere

Added to portage

2026-02-10

sudo-rs - 0.2.12
Ebuild name:

app-admin/sudo-rs-0.2.12

Description

A memory safe implementation of sudo and su.

Added to portage

2026-02-10

torchvision - 0.24.1-r1
Ebuild name:

sci-ml/torchvision-0.24.1-r1

Description

Datasets, transforms and models to specific to computer vision

Added to portage

2026-02-10

tyxml - 4.6.0_p20260130
Ebuild name:

dev-ml/tyxml-4.6.0_p20260130

Description

A library for building correct HTML and SVG documents

Added to portage

2026-02-10

u-boot-tools - 2025.01-r2
Ebuild name:

dev-embedded/u-boot-tools-2025.01-r2

Description

utilities for working with Das U-Boot

Added to portage

2026-02-10

websocket - 1.16
Ebuild name:

app-emacs/websocket-1.16

Description

A websocket implementation in elisp

Added to portage

2026-02-10

2026-02-09
Image-Scale - 0.140.0-r1
Ebuild name:

dev-perl/Image-Scale-0.140.0-r1

Description

Fast, high-quality fixed-point image resizing

Added to portage

2026-02-09

astroid - 4.1.0
Ebuild name:

dev-python/astroid-4.1.0

Description

Abstract Syntax Tree for logilab packages

Added to portage

2026-02-09

awkward-cpp - 52
Ebuild name:

dev-python/awkward-cpp-52

Description

CPU kernels and compiled extensions for Awkward Array

Added to portage

2026-02-09

borgmatic - 2.1.2
Ebuild name:

app-backup/borgmatic-2.1.2

Description

Automatically create, prune and verify backups with borgbackup

Added to portage

2026-02-09

byte-buddy - 1.18.4
Ebuild name:

dev-java/byte-buddy-1.18.4

Description

Offers convenience for attaching an agent to the local or a remote VM

Added to portage

2026-02-09

chafa - 1.18.1
Ebuild name:

media-gfx/chafa-1.18.1

Description

versatile and fast Unicode/ASCII/ANSI graphics renderer

Added to portage

2026-02-09

claude-code - 2.1.37
Ebuild name:

dev-util/claude-code-2.1.37

Description

Claude Code - an agentic coding tool by Anthropic

Added to portage

2026-02-09

dracut - 110
Ebuild name:

sys-kernel/dracut-110

Description

Generic initramfs generation tool

Added to portage

2026-02-09

ensurepip-setuptools - 82.0.0
Ebuild name:

dev-python/ensurepip-setuptools-82.0.0

Description

Shared setuptools wheel for ensurepip Python module

Added to portage

2026-02-09

freenet - 0.7.5_p1505
Ebuild name:

net-p2p/freenet-0.7.5_p1505

Description

Freenet REference Daemon

Added to portage

2026-02-09

freenet - 0.7.5_p1505-r1
Ebuild name:

net-p2p/freenet-0.7.5_p1505-r1

Description

Freenet REference Daemon

Added to portage

2026-02-09

freenet-ext - 29-r3
Ebuild name:

dev-java/freenet-ext-29-r3

Description

Freenet REference Daemon

Added to portage

2026-02-09

gcc - 16.0.1_p20260208-r1
Ebuild name:

sys-devel/gcc-16.0.1_p20260208-r1

Description

The GNU Compiler Collection

Added to portage

2026-02-09

haproxy - 3.0.15
Ebuild name:

net-proxy/haproxy-3.0.15

Description

A TCP/HTTP reverse proxy for high availability environments

Added to portage

2026-02-09

haproxy - 3.2.11
Ebuild name:

net-proxy/haproxy-3.2.11

Description

A TCP/HTTP reverse proxy for high availability environments

Added to portage

2026-02-09

haproxy - 3.3.2
Ebuild name:

net-proxy/haproxy-3.3.2

Description

A TCP/HTTP reverse proxy for high availability environments

Added to portage

2026-02-09

installkernel - 66
Ebuild name:

sys-kernel/installkernel-66

Description

Gentoo fork of installkernel script from debianutils

Added to portage

2026-02-09

jaconv - 0.5.0
Ebuild name:

dev-python/jaconv-0.5.0

Description

Pure-Python Japanese character interconverter

Added to portage

2026-02-09

jaraco-text - 4.1.0
Ebuild name:

dev-python/jaraco-text-4.1.0

Description

Text utilities used by other projects by developer jaraco

Added to portage

2026-02-09

krita - 6.0.0_beta1-r1
Ebuild name:

media-gfx/krita-6.0.0_beta1-r1

Description

Free digital painting application. Digital Painting, Creative Freedo

Added to portage

2026-02-09

kwin - 6.5.5-r1
Ebuild name:

kde-plasma/kwin-6.5.5-r1

Description

Flexible, composited Window Manager for windowing systems on Linux

Added to portage

2026-02-09

less - 692
Ebuild name:

sys-apps/less-692

Description

Excellent text file viewer

Added to portage

2026-02-09

libXmu - 1.3.1
Ebuild name:

x11-libs/libXmu-1.3.1

Description

X.Org Xmu library

Added to portage

2026-02-09

libvpl - 2.16.0
Ebuild name:

media-libs/libvpl-2.16.0

Description

Intel Video Processing Library dispatcher

Added to portage

2026-02-09

libvpl-tools - 1.5.0
Ebuild name:

media-libs/libvpl-tools-1.5.0

Description

Intel Video Processing Library tools

Added to portage

2026-02-09

lmdb - 0.9.35
Ebuild name:

dev-db/lmdb-0.9.35

Description

An ultra-fast, ultra-compact key-value embedded data store

Added to portage

2026-02-09

m2crypto - 0.47.0
Ebuild name:

dev-python/m2crypto-0.47.0

Description

A Python crypto and SSL toolkit

Added to portage

2026-02-09

mit-krb5 - 1.22.2
Ebuild name:

app-crypt/mit-krb5-1.22.2

Description

MIT Kerberos V

Added to portage

2026-02-09

moto - 5.1.21
Ebuild name:

dev-python/moto-5.1.21

Description

Mock library for boto

Added to portage

2026-02-09

ncspot - 1.3.3
Ebuild name:

media-sound/ncspot-1.3.3

Description

ncurses Spotify client written in Rust using librespot

Added to portage

2026-02-09

nxml-libvirt-schemas - 11.10.0
Ebuild name:

app-emacs/nxml-libvirt-schemas-11.10.0

Description

Extension for nxml-mode with libvirt schemas

Added to portage

2026-02-09

pypdf - 6.7.0
Ebuild name:

dev-python/pypdf-6.7.0

Description

Python library to work with PDF files

Added to portage

2026-02-09

pyproject-fmt - 2.14.1
Ebuild name:

dev-python/pyproject-fmt-2.14.1

Description

Format your pyproject.toml file

Added to portage

2026-02-09

pyside - 6.10.1-r6
Ebuild name:

dev-python/pyside-6.10.1-r6

Description

Python bindings for the Qt framework

Added to portage

2026-02-09

python-debian - 1.1.0
Ebuild name:

dev-python/python-debian-1.1.0

Description

Python modules to work with Debian-related data formats

Added to portage

2026-02-09

roundcube - 1.6.13
Ebuild name:

mail-client/roundcube-1.6.13

Description

Browser-based multilingual IMAP client with an application-like user i

Added to portage

2026-02-09

setuptools - 82.0.0
Ebuild name:

dev-python/setuptools-82.0.0

Description

Collection of extensions to Distutils

Added to portage

2026-02-09

slixmpp - 1.13.2
Ebuild name:

dev-python/slixmpp-1.13.2

Description

Python 3 library for XMPP

Added to portage

2026-02-09

stalonetray - 1.0.1
Ebuild name:

x11-misc/stalonetray-1.0.1

Description

System tray utility including support for KDE system tray icons

Added to portage

2026-02-09

superqt - 0.7.8
Ebuild name:

dev-python/superqt-0.7.8

Description

Missing widgets and components for PyQt/PySide

Added to portage

2026-02-09

swayidle - 1.9.0
Ebuild name:

gui-apps/swayidle-1.9.0

Description

Idle management daemon for Wayland

Added to portage

2026-02-09

thriftpy2 - 0.6.0
Ebuild name:

dev-python/thriftpy2-0.6.0

Description

Pure python approach of Apache Thrift

Added to portage

2026-02-09

tsm - 8.1.27.1-r1
Ebuild name:

app-backup/tsm-8.1.27.1-r1

Description

IBM Storage Protect (former Tivoli Storage Manager) Backup/Archive Clien

Added to portage

2026-02-09

ubelt - 1.4.1
Ebuild name:

dev-python/ubelt-1.4.1

Description

A stdlib like feel, and extra batteries. Hashing, Caching, Timing, Progress

Added to portage

2026-02-09

unbound - 1.24.2
Ebuild name:

net-dns/unbound-1.24.2

Description

A validating, recursive and caching DNS resolver

Added to portage

2026-02-09

vpl-gpu-rt - 26.1.1
Ebuild name:

media-libs/vpl-gpu-rt-26.1.1

Description

Intel Video Processing Library GPU Runtime

Added to portage

2026-02-09

z3 - 4.15.7
Ebuild name:

sci-mathematics/z3-4.15.7

Description

An efficient theorem prover

Added to portage

2026-02-09

zotero-bin - 7.0.32
Ebuild name:

app-text/zotero-bin-7.0.32

Description

Helps you collect, organize, cite, and share your research sources

Added to portage

2026-02-09

zotero-bin - 8.0.3
Ebuild name:

app-text/zotero-bin-8.0.3

Description

Helps you collect, organize, cite, and share your research sources

Added to portage

2026-02-09

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