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:

83734

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-03-13
awscli - 1.44.57
Ebuild name:

app-admin/awscli-1.44.57

Description

Universal Command Line Environment for AWS

Added to portage

2026-03-13

bitstring - 4.4.0
Ebuild name:

dev-python/bitstring-4.4.0

Description

A pure Python module for creation and analysis of binary data

Added to portage

2026-03-13

boto3 - 1.42.67
Ebuild name:

dev-python/boto3-1.42.67

Description

The AWS SDK for Python

Added to portage

2026-03-13

botocore - 1.42.67
Ebuild name:

dev-python/botocore-1.42.67

Description

Low-level, data-driven core of boto 3

Added to portage

2026-03-13

claude-code - 2.1.74
Ebuild name:

dev-util/claude-code-2.1.74

Description

Claude Code - an agentic coding tool by Anthropic

Added to portage

2026-03-13

google-auth - 2.49.1
Ebuild name:

dev-python/google-auth-2.49.1

Description

Google Authentication Library

Added to portage

2026-03-13

mu-cite - 8.1_p202011031127
Ebuild name:

app-emacs/mu-cite-8.1_p202011031127

Description

Message citation utilities for emacsen

Added to portage

2026-03-13

nuitka - 4.0.5
Ebuild name:

dev-python/nuitka-4.0.5

Description

Python to native compiler

Added to portage

2026-03-13

openapi-core - 0.23.0
Ebuild name:

dev-python/openapi-core-0.23.0

Description

Client-side and server-side support for the OpenAPI Specification v3

Added to portage

2026-03-13

org-modern - 1.13
Ebuild name:

app-emacs/org-modern-1.13

Description

Modern style for your GNU Emacs Org buffers

Added to portage

2026-03-13

pecan - 1.8.0
Ebuild name:

dev-python/pecan-1.8.0

Description

A WSGI object-dispatching web framework, lean, fast, with few dependencies

Added to portage

2026-03-13

postfix - 3.11.1-r1
Ebuild name:

mail-mta/postfix-3.11.1-r1

Description

A fast and secure drop-in replacement for sendmail

Added to portage

2026-03-13

postfix - 3.12_pre20260312
Ebuild name:

mail-mta/postfix-3.12_pre20260312

Description

A fast and secure drop-in replacement for sendmail

Added to portage

2026-03-13

pyjwt - 2.12.0
Ebuild name:

dev-python/pyjwt-2.12.0

Description

JSON Web Token implementation in Python

Added to portage

2026-03-13

pytest-env - 1.6.0
Ebuild name:

dev-python/pytest-env-1.6.0

Description

pytest plugin that allows you to add environment variables

Added to portage

2026-03-13

tempel - 1.12
Ebuild name:

app-emacs/tempel-1.12

Description

Templates with in-buffer field editing for GNU Emacs

Added to portage

2026-03-13

tibs - 0.5.7
Ebuild name:

dev-python/tibs-0.5.7

Description

A sleek Python library for your binary data

Added to portage

2026-03-13

vertico - 2.8
Ebuild name:

app-emacs/vertico-2.8

Description

Vertical interactive completion

Added to portage

2026-03-13

yt-dlp - 2026.03.13
Ebuild name:

net-misc/yt-dlp-2026.03.13

Description

youtube-dl fork with additional features and fixes

Added to portage

2026-03-13

yt-dlp-ejs - 0.7.0
Ebuild name:

dev-python/yt-dlp-ejs-0.7.0

Description

External JavaScript for yt-dlp supporting many runtimes

Added to portage

2026-03-13

zsnes - 2.1.0
Ebuild name:

games-emulation/zsnes-2.1.0

Description

Fork of the classic Super Nintendo emulator

Added to portage

2026-03-13

2026-03-12
ant - 1.10.15-r1
Ebuild name:

dev-java/ant-1.10.15-r1

Description

Java-based build tool similar to 'make' that uses XML configuration files

Added to portage

2026-03-12

apsw - 3.52.0.0
Ebuild name:

dev-python/apsw-3.52.0.0

Description

APSW - Another Python SQLite Wrapper

Added to portage

2026-03-12

awscli - 1.44.56
Ebuild name:

app-admin/awscli-1.44.56

Description

Universal Command Line Environment for AWS

Added to portage

2026-03-12

black - 26.3.1
Ebuild name:

dev-python/black-26.3.1

Description

The uncompromising Python code formatter

Added to portage

2026-03-12

boto3 - 1.42.66
Ebuild name:

dev-python/boto3-1.42.66

Description

The AWS SDK for Python

Added to portage

2026-03-12

botocore - 1.42.66
Ebuild name:

dev-python/botocore-1.42.66

Description

Low-level, data-driven core of boto 3

Added to portage

2026-03-12

chrome-binary-plugins - 147.0.7727.3_beta
Ebuild name:

www-plugins/chrome-binary-plugins-147.0.7727.3_beta

Description

Binary plugins from Google Chrome for use in Ch

Added to portage

2026-03-12

chromium - 147.0.7727.3
Ebuild name:

www-client/chromium-147.0.7727.3

Description

Open-source version of Google Chrome web browser

Added to portage

2026-03-12

commons-logging - 1.3.6
Ebuild name:

dev-java/commons-logging-1.3.6

Description

Thin adapter allowing configurable bridging to other well known logg

Added to portage

2026-03-12

cvector - 1.0.4.1
Ebuild name:

dev-libs/cvector-1.0.4.1

Description

An ANSI C implementation of dynamic arrays (approximation of C++ vectors)

Added to portage

2026-03-12

deno-bin - 2.7.5
Ebuild name:

dev-lang/deno-bin-2.7.5

Description

Modern runtime for JavaScript and TypeScript

Added to portage

2026-03-12

dist-kernel - 6.18.17
Ebuild name:

virtual/dist-kernel-6.18.17

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-03-12

dist-kernel - 6.19.7
Ebuild name:

virtual/dist-kernel-6.19.7

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-03-12

dotnet-outdated - 4.7.1
Ebuild name:

dev-dotnet/dotnet-outdated-4.7.1

Description

Display and update outdated NuGet packages in a project

Added to portage

2026-03-12

filelock - 3.25.2
Ebuild name:

dev-python/filelock-3.25.2

Description

A platform independent file lock for Python

Added to portage

2026-03-12

gentoo-kernel - 6.18.17
Ebuild name:

sys-kernel/gentoo-kernel-6.18.17

Description

Linux kernel built with Gentoo patches

Added to portage

2026-03-12

gentoo-kernel - 6.19.7
Ebuild name:

sys-kernel/gentoo-kernel-6.19.7

Description

Linux kernel built with Gentoo patches

Added to portage

2026-03-12

gentoo-kernel-bin - 6.18.17
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.18.17

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-03-12

gentoo-kernel-bin - 6.19.7
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.19.7

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-03-12

ghdl - 6.0.0
Ebuild name:

sci-electronics/ghdl-6.0.0

Description

Open-source analyzer, compiler, and simulator for VHDL 2008/93/87

Added to portage

2026-03-12

ghostty - 1.3.0-r1
Ebuild name:

x11-terms/ghostty-1.3.0-r1

Description

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

Added to portage

2026-03-12

google-chrome-beta - 147.0.7727.3
Ebuild name:

www-client/google-chrome-beta-147.0.7727.3

Description

The web browser from Google

Added to portage

2026-03-12

ig - 0.50.1
Ebuild name:

app-admin/ig-0.50.1

Description

Tools and framework for data collection and system inspection using eBPF

Added to portage

2026-03-12

jupyterlab - 4.5.6
Ebuild name:

dev-python/jupyterlab-4.5.6

Description

JupyterLab computational environment

Added to portage

2026-03-12

man-pages-ja - 20260115-r1
Ebuild name:

app-i18n/man-pages-ja-20260115-r1

Description

Collection of manual pages translated into Japanese

Added to portage

2026-03-12

maven-bin - 3.9.13
Ebuild name:

dev-java/maven-bin-3.9.13

Description

Project Management and Comprehension Tool for Java

Added to portage

2026-03-12

microsoft-edge-beta - 146.0.3856.54
Ebuild name:

www-client/microsoft-edge-beta-146.0.3856.54

Description

The web browser from Microsoft

Added to portage

2026-03-12

multi-term - 1.4-r1
Ebuild name:

app-emacs/multi-term-1.4-r1

Description

Manage multiple terminal buffers in Emacs

Added to portage

2026-03-12

notebook - 7.5.5
Ebuild name:

dev-python/notebook-7.5.5

Description

Jupyter Interactive Notebook

Added to portage

2026-03-12

nvc - 1.19.3
Ebuild name:

sci-electronics/nvc-1.19.3

Description

NVC is a VHDL compiler and simulator

Added to portage

2026-03-12

openpgp-keys-apache-maven - 20250309
Ebuild name:

sec-keys/openpgp-keys-apache-maven-20250309

Description

OpenPGP keys used by maven.apache.org

Added to portage

2026-03-12

qlementine - 1.4.2
Ebuild name:

dev-qt/qlementine-1.4.2

Description

Modern QStyle for desktop Qt6 applications.

Added to portage

2026-03-12

qt-creator - 19.0.0
Ebuild name:

dev-qt/qt-creator-19.0.0

Description

Lightweight IDE for C++/QML development centering around Qt

Added to portage

2026-03-12

simpleeval - 1.0.4
Ebuild name:

dev-python/simpleeval-1.0.4

Description

A simple, safe single expression evaluator library

Added to portage

2026-03-12

socket_wrapper - 1.5.2
Ebuild name:

net-libs/socket_wrapper-1.5.2

Description

Library passing all socket communications through unix sockets

Added to portage

2026-03-12

solarus - 2.0.3-r1
Ebuild name:

games-engines/solarus-2.0.3-r1

Description

An open-source Zelda-like 2D game engine

Added to portage

2026-03-12

solarus-quest-editor - 2.0.3
Ebuild name:

games-misc/solarus-quest-editor-2.0.3

Description

Quest editor for Solarus game engine

Added to portage

2026-03-12

sqlite - 3.52.0-r1
Ebuild name:

dev-db/sqlite-3.52.0-r1

Description

SQL database engine

Added to portage

2026-03-12

thunderbird - 140.8.1
Ebuild name:

mail-client/thunderbird-140.8.1

Description

Thunderbird Mail Client

Added to portage

2026-03-12

thunderbird-bin - 140.8.1
Ebuild name:

mail-client/thunderbird-bin-140.8.1

Description

Thunderbird Mail Client

Added to portage

2026-03-12

tmuxp - 1.67.0
Ebuild name:

app-misc/tmuxp-1.67.0

Description

tmux session manager. built on libtmux

Added to portage

2026-03-12

ujson - 5.12.0
Ebuild name:

dev-python/ujson-5.12.0

Description

Ultra fast JSON encoder and decoder for Python

Added to portage

2026-03-12

vanilla-kernel - 6.18.17
Ebuild name:

sys-kernel/vanilla-kernel-6.18.17

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-03-12

vanilla-kernel - 6.19.7
Ebuild name:

sys-kernel/vanilla-kernel-6.19.7

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-03-12

vanilla-sources - 6.18.17
Ebuild name:

sys-kernel/vanilla-sources-6.18.17

Description

Full sources for the Linux kernel

Added to portage

2026-03-12

vanilla-sources - 6.19.7
Ebuild name:

sys-kernel/vanilla-sources-6.19.7

Description

Full sources for the Linux kernel

Added to portage

2026-03-12

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