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:

88050

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-08-31
apprise - 1.13.1
Ebuild name:

dev-python/apprise-1.13.1

Description

Push Notifications that work with just about every platform

Added to portage

2026-08-31

authlib - 1.8.0
Ebuild name:

dev-python/authlib-1.8.0

Description

A Python library in building OAuth and OpenID Connect servers and clients

Added to portage

2026-08-31

django-tables2 - 3.0.1
Ebuild name:

dev-python/django-tables2-3.0.1

Description

Table/data-grid framework for Django

Added to portage

2026-08-31

elixir - 1.16.3-r2
Ebuild name:

dev-lang/elixir-1.16.3-r2

Description

Elixir programming language

Added to portage

2026-08-31

elixir - 1.17.3-r2
Ebuild name:

dev-lang/elixir-1.17.3-r2

Description

Elixir programming language

Added to portage

2026-08-31

elixir - 1.18.5
Ebuild name:

dev-lang/elixir-1.18.5

Description

Elixir programming language

Added to portage

2026-08-31

elixir - 1.19.6
Ebuild name:

dev-lang/elixir-1.19.6

Description

Elixir programming language

Added to portage

2026-08-31

elixir - 1.20.4
Ebuild name:

dev-lang/elixir-1.20.4

Description

Elixir programming language

Added to portage

2026-08-31

gcc - 17.0.0_p20260830
Ebuild name:

sys-devel/gcc-17.0.0_p20260830

Description

The GNU Compiler Collection

Added to portage

2026-08-31

git-sources - 7.3_rc1
Ebuild name:

sys-kernel/git-sources-7.3_rc1

Description

The very latest -git version of the Linux kernel

Added to portage

2026-08-31

hypothesis - 6.167.1
Ebuild name:

dev-python/hypothesis-6.167.1

Description

A library for property based testing

Added to portage

2026-08-31

ibus-rime - 1.6.1
Ebuild name:

app-i18n/ibus-rime-1.6.1

Description

Chinese Rime Input Method Engine for IBus

Added to portage

2026-08-31

imlib2 - 1.12.7
Ebuild name:

media-libs/imlib2-1.12.7

Description

Version 2 of an advanced replacement library for libraries like libXpm

Added to portage

2026-08-31

imlib2_loaders - 1.12.7
Ebuild name:

media-plugins/imlib2_loaders-1.12.7

Description

Additional image loaders for Imlib2

Added to portage

2026-08-31

iosevka - 34.8.1
Ebuild name:

media-fonts/iosevka-34.8.1

Description

Slender typeface for code, from code

Added to portage

2026-08-31

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-08-31

nzbget - 26.3
Ebuild name:

net-nntp/nzbget-26.3

Description

A command-line based binary newsgrabber supporting .nzb files

Added to portage

2026-08-31

pcsx2 - 2.8.0
Ebuild name:

games-emulation/pcsx2-2.8.0

Description

PlayStation 2 emulator

Added to portage

2026-08-31

pcsx2_patches - 0_p20260810
Ebuild name:

games-emulation/pcsx2_patches-0_p20260810

Description

Collection of game patches for use with PCSX2 (e.g. wides

Added to portage

2026-08-31

pyrate-limiter - 4.5.0
Ebuild name:

dev-python/pyrate-limiter-4.5.0

Description

Python Rate-Limiter using Leaky-Bucket Algorimth Family

Added to portage

2026-08-31

python-engineio - 4.14.0
Ebuild name:

dev-python/python-engineio-4.14.0

Description

Python implementation of the Engine.IO realtime server

Added to portage

2026-08-31

pyzotero - 1.15.1
Ebuild name:

dev-python/pyzotero-1.15.1

Description

A Python client for the Zotero API

Added to portage

2026-08-31

rapidfuzz - 3.14.6
Ebuild name:

dev-python/rapidfuzz-3.14.6

Description

Rapid fuzzy string matching in Python using various string metrics

Added to portage

2026-08-31

rapidfuzz-cpp - 3.3.4
Ebuild name:

dev-cpp/rapidfuzz-cpp-3.3.4

Description

Rapid fuzzy string matching in C++

Added to portage

2026-08-31

regex - 2026.8.31
Ebuild name:

dev-python/regex-2026.8.31

Description

Alternative regular expression module to replace re

Added to portage

2026-08-31

rq - 2.12.0
Ebuild name:

dev-python/rq-2.12.0

Description

Simple, lightweight library for creating and processing background jobs

Added to portage

2026-08-31

sway - 1.11-r1
Ebuild name:

gui-wm/sway-1.11-r1

Description

i3-compatible Wayland window manager

Added to portage

2026-08-31

sway - 1.12-r1
Ebuild name:

gui-wm/sway-1.12-r1

Description

i3-compatible Wayland window manager

Added to portage

2026-08-31

teamviewer - 15.81.5
Ebuild name:

net-misc/teamviewer-15.81.5

Description

All-In-One Solution for Remote Access and Support over the Internet

Added to portage

2026-08-31

transformers - 5.16.1
Ebuild name:

sci-ml/transformers-5.16.1

Description

State-of-the-art Machine Learning for JAX, PyTorch and TensorFlow

Added to portage

2026-08-31

tuba - 0.11.1
Ebuild name:

net-misc/tuba-0.11.1

Description

Browse the Fediverse (GTK client)

Added to portage

2026-08-31

wrapt - 2.4.0
Ebuild name:

dev-python/wrapt-2.4.0

Description

Module for decorators, wrappers and monkey patching

Added to portage

2026-08-31

zeroconf - 0.151.3
Ebuild name:

dev-python/zeroconf-0.151.3

Description

Pure Python Multicast DNS Service Discovery Library (Bonjour/Avahi comp

Added to portage

2026-08-31

zoxide - 0.10.0
Ebuild name:

app-shells/zoxide-0.10.0

Description

A smarter cd command for your terminal

Added to portage

2026-08-31

2026-08-30
ansi2html - 1.9.3
Ebuild name:

dev-python/ansi2html-1.9.3

Description

Convert text with ANSI color codes to HTML

Added to portage

2026-08-30

bcachefs-tools - 1.39.3
Ebuild name:

sys-fs/bcachefs-tools-1.39.3

Description

Tools for bcachefs

Added to portage

2026-08-30

bitwarden-desktop-bin - 2026.8.0
Ebuild name:

app-admin/bitwarden-desktop-bin-2026.8.0

Description

Bitwarden password manager desktop client

Added to portage

2026-08-30

boost - 1.92.0
Ebuild name:

dev-libs/boost-1.92.0

Description

Boost Libraries for C++

Added to portage

2026-08-30

bubblewrap - 0.12.0
Ebuild name:

sys-apps/bubblewrap-0.12.0

Description

Unprivileged sandboxing tool, namespaces-powered chroot-like solution

Added to portage

2026-08-30

doggo - 1.3.0
Ebuild name:

net-dns/doggo-1.3.0

Description

Command-line DNS Client for Humans

Added to portage

2026-08-30

dovecot - 2.4.5
Ebuild name:

net-mail/dovecot-2.4.5

Description

An IMAP and POP3 server written with security primarily in mind

Added to portage

2026-08-30

environs - 15.2.0
Ebuild name:

dev-python/environs-15.2.0

Description

Python library for simplified environment variable parsing

Added to portage

2026-08-30

feh - 3.12.4
Ebuild name:

media-gfx/feh-3.12.4

Description

A fast, lightweight imageviewer using imlib2

Added to portage

2026-08-30

filezilla - 3.71.1
Ebuild name:

net-ftp/filezilla-3.71.1

Description

FTP client with lots of useful features and an intuitive interface

Added to portage

2026-08-30

gcc - 13.4.1_p20260826
Ebuild name:

sys-devel/gcc-13.4.1_p20260826

Description

The GNU Compiler Collection

Added to portage

2026-08-30

gcc - 14.4.1_p20260827
Ebuild name:

sys-devel/gcc-14.4.1_p20260827

Description

The GNU Compiler Collection

Added to portage

2026-08-30

gcc - 15.3.1_p20260828
Ebuild name:

sys-devel/gcc-15.3.1_p20260828

Description

The GNU Compiler Collection

Added to portage

2026-08-30

gcc - 16.2.1_p20260829
Ebuild name:

sys-devel/gcc-16.2.1_p20260829

Description

The GNU Compiler Collection

Added to portage

2026-08-30

gentoolkit - 0.8.1
Ebuild name:

app-portage/gentoolkit-0.8.1

Description

Collection of administration scripts for Gentoo

Added to portage

2026-08-30

gitea - 1.27.3
Ebuild name:

www-apps/gitea-1.27.3

Description

A painless self-hosted Git service

Added to portage

2026-08-30

hypothesis - 6.166.0
Ebuild name:

dev-python/hypothesis-6.166.0

Description

A library for property based testing

Added to portage

2026-08-30

incus - 7.4
Ebuild name:

app-containers/incus-7.4

Description

Modern, secure and powerful system container and virtual machine manager

Added to portage

2026-08-30

joserfc - 1.7.5
Ebuild name:

dev-python/joserfc-1.7.5

Description

A Python library for JOSE RFCs JWS, JWE, JWK, JWA, JWT

Added to portage

2026-08-30

lego - 5.4.0
Ebuild name:

app-crypt/lego-5.4.0

Description

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

Added to portage

2026-08-30

linkify-it-py - 2.2.0
Ebuild name:

dev-python/linkify-it-py-2.2.0

Description

Links recognition library with full unicode support

Added to portage

2026-08-30

lmdb - 1.0.1-r3
Ebuild name:

dev-db/lmdb-1.0.1-r3

Description

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

Added to portage

2026-08-30

luajit - 2.1.1787165859
Ebuild name:

dev-lang/luajit-2.1.1787165859

Description

Just-In-Time Compiler for the Lua programming language

Added to portage

2026-08-30

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-08-30

micawber - 0.7.1
Ebuild name:

dev-python/micawber-0.7.1

Description

A small library for extracting rich content from urls

Added to portage

2026-08-30

patsy - 1.0.3
Ebuild name:

dev-python/patsy-1.0.3

Description

Python module to describe statistical models and design matrices

Added to portage

2026-08-30

pdm - 2.29.0
Ebuild name:

dev-python/pdm-2.29.0

Description

Python package and dependency manager supporting the latest PEP standards

Added to portage

2026-08-30

pkgcore - 0.12.41
Ebuild name:

sys-apps/pkgcore-0.12.41

Description

a framework for package management

Added to portage

2026-08-30

poetry - 2.4.2
Ebuild name:

dev-python/poetry-2.4.2

Description

A frontend for poetry - a python dependency management and packaging tool

Added to portage

2026-08-30

pylint - 4.0.8
Ebuild name:

dev-python/pylint-4.0.8

Description

Python code static checker

Added to portage

2026-08-30

pyzotero - 1.15.0
Ebuild name:

dev-python/pyzotero-1.15.0

Description

A Python client for the Zotero API

Added to portage

2026-08-30

quart - 0.23.1
Ebuild name:

dev-python/quart-0.23.1

Description

A Python ASGI web microframework with the same API as Flask

Added to portage

2026-08-30

quart-trio - 0.12.0-r1
Ebuild name:

dev-python/quart-trio-0.12.0-r1

Description

A Quart extension to provide trio support

Added to portage

2026-08-30

rust-parallel - 1.24.0
Ebuild name:

sys-process/rust-parallel-1.24.0

Description

Fast command line app to run commands in parallel

Added to portage

2026-08-30

skk-jisyo - 202605
Ebuild name:

app-i18n/skk-jisyo-202605

Description

Jisyo (dictionary) files for the SKK Japanese-input software

Added to portage

2026-08-30

tuned - 2.28.0
Ebuild name:

sys-apps/tuned-2.28.0

Description

Daemon for monitoring and adaptive tuning of system devices

Added to portage

2026-08-30

websocket-client - 1.9.1
Ebuild name:

dev-python/websocket-client-1.9.1

Description

WebSocket client for python with hybi13 support

Added to portage

2026-08-30

zeroconf - 0.151.2
Ebuild name:

dev-python/zeroconf-0.151.2

Description

Pure Python Multicast DNS Service Discovery Library (Bonjour/Avahi comp

Added to portage

2026-08-30

zotero-bin - 10.0.1
Ebuild name:

app-text/zotero-bin-10.0.1

Description

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

Added to portage

2026-08-30

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