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:

87727

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-17
DBI - 1.652.0
Ebuild name:

dev-perl/DBI-1.652.0

Description

Database independent interface for Perl

Added to portage

2026-08-17

arti - 2.5.1
Ebuild name:

net-p2p/arti-2.5.1

Description

Implementation of Tor in Rust

Added to portage

2026-08-17

chrony_exporter - 0.14.0
Ebuild name:

app-metrics/chrony_exporter-0.14.0

Description

Chrony NTP exporter for Prometheus

Added to portage

2026-08-17

codipack - 3.1.2
Ebuild name:

sys-cluster/codipack-3.1.2

Description

Fast gradient evaluation in C++ based on Expression Templates

Added to portage

2026-08-17

gagit - 4
Ebuild name:

dev-vcs/gagit-4

Description

Gentoo AGit workflow tool

Added to portage

2026-08-17

kguiaddons - 6.29.0-r1
Ebuild name:

kde-frameworks/kguiaddons-6.29.0-r1

Description

Framework providing assorted high-level user interface componen

Added to portage

2026-08-17

kirigami - 6.29.0-r1
Ebuild name:

kde-frameworks/kirigami-6.29.0-r1

Description

Lightweight user interface framework for mobile and convergent ap

Added to portage

2026-08-17

libquo - 1.4.1
Ebuild name:

sys-cluster/libquo-1.4.1

Description

Run-time tuning of process binding policies made easy

Added to portage

2026-08-17

openpgp-keys-patrick96 - 20260816
Ebuild name:

sec-keys/openpgp-keys-patrick96-20260816

Description

OpenPGP keys used by Patrick Ziegler

Added to portage

2026-08-17

openpgp-keys-putty-release - 2026
Ebuild name:

sec-keys/openpgp-keys-putty-release-2026

Description

PuTTY Release Key

Added to portage

2026-08-17

polybar - 3.7.2-r1
Ebuild name:

x11-misc/polybar-3.7.2-r1

Description

A fast and easy-to-use tool for creating status bars

Added to portage

2026-08-17

putty - 0.85
Ebuild name:

net-misc/putty-0.85

Description

A Free Telnet/SSH Client

Added to portage

2026-08-17

tree-sitter - 0.26.12
Ebuild name:

dev-libs/tree-sitter-0.26.12

Description

Tree-sitter is a parser generator tool and an incremental parsing libr

Added to portage

2026-08-17

tree-sitter-cli - 0.26.12
Ebuild name:

dev-util/tree-sitter-cli-0.26.12

Description

Command-line tool for creating and testing tree-sitter grammars

Added to portage

2026-08-17

xaos - 4.3.7
Ebuild name:

x11-misc/xaos-4.3.7

Description

Very fast real-time fractal zoomer

Added to portage

2026-08-17

zsh - 5.9.2
Ebuild name:

app-shells/zsh-5.9.2

Description

UNIX Shell similar to the Korn shell

Added to portage

2026-08-17

zxing-cpp - 3.1.1
Ebuild name:

media-libs/zxing-cpp-3.1.1

Description

C++ Multi-format 1D/2D barcode image processing library

Added to portage

2026-08-17

2026-08-16
arj - 3.10.22_p29
Ebuild name:

app-arch/arj-3.10.22_p29

Description

Utility for opening arj archives

Added to portage

2026-08-16

backports-zstd - 1.7.0
Ebuild name:

dev-python/backports-zstd-1.7.0

Description

Backport of PEP-784 adding Zstandard to the standard library

Added to portage

2026-08-16

borgmatic - 2.1.7
Ebuild name:

app-backup/borgmatic-2.1.7

Description

Automatically create, prune and verify backups with borgbackup

Added to portage

2026-08-16

charset-normalizer - 3.5.1
Ebuild name:

dev-python/charset-normalizer-3.5.1

Description

The Real First Universal Charset Detector

Added to portage

2026-08-16

containerd - 2.3.4
Ebuild name:

app-containers/containerd-2.3.4

Description

A daemon to control runC

Added to portage

2026-08-16

crun - 1.29.1
Ebuild name:

app-containers/crun-1.29.1

Description

Fast and low-memory footprint OCI Container Runtime fully written in C

Added to portage

2026-08-16

duplicity - 3.2.0.1
Ebuild name:

app-backup/duplicity-3.2.0.1

Description

Secure backup system using GnuPG to encrypt data

Added to portage

2026-08-16

fastjsonschema - 2.22.2
Ebuild name:

dev-python/fastjsonschema-2.22.2

Description

Fast JSON schema validator for Python

Added to portage

2026-08-16

gcc - 13.4.1_p20260812
Ebuild name:

sys-devel/gcc-13.4.1_p20260812

Description

The GNU Compiler Collection

Added to portage

2026-08-16

gcc - 14.4.1_p20260813
Ebuild name:

sys-devel/gcc-14.4.1_p20260813

Description

The GNU Compiler Collection

Added to portage

2026-08-16

gcc - 15.3.1_p20260814
Ebuild name:

sys-devel/gcc-15.3.1_p20260814

Description

The GNU Compiler Collection

Added to portage

2026-08-16

gcc - 16.2.1_p20260815
Ebuild name:

sys-devel/gcc-16.2.1_p20260815

Description

The GNU Compiler Collection

Added to portage

2026-08-16

ggml - 0.19.0-r1
Ebuild name:

sci-ml/ggml-0.19.0-r1

Description

Tensor library for machine learning

Added to portage

2026-08-16

ggml - 0.20.0-r1
Ebuild name:

sci-ml/ggml-0.20.0-r1

Description

Tensor library for machine learning

Added to portage

2026-08-16

kitinerary - 26.04.3-r2
Ebuild name:

kde-apps/kitinerary-26.04.3-r2

Description

Data Model and Extraction System for Travel Reservation information

Added to portage

2026-08-16

libatasmart - 0.19_p6
Ebuild name:

dev-libs/libatasmart-0.19_p6

Description

Small and lightweight parser library for ATA S.M.A.R.T. hard disks

Added to portage

2026-08-16

macrostep-geiser - 0.2.0_p20210717
Ebuild name:

app-emacs/macrostep-geiser-0.2.0_p20210717

Description

Emacs macrostep back-end powered by geiser

Added to portage

2026-08-16

magit - 4.5.0-r1
Ebuild name:

app-emacs/magit-4.5.0-r1

Description

A Git porcelain inside Emacs

Added to portage

2026-08-16

magit - 4.6.0
Ebuild name:

app-emacs/magit-4.6.0

Description

A Git porcelain inside Emacs

Added to portage

2026-08-16

magit - 4.7.0
Ebuild name:

app-emacs/magit-4.7.0

Description

A Git porcelain inside Emacs

Added to portage

2026-08-16

magit - 9999
Ebuild name:

app-emacs/magit-9999

Description

A Git porcelain inside Emacs

Added to portage

2026-08-16

magit-popup - 2.13.3-r1
Ebuild name:

app-emacs/magit-popup-2.13.3-r1

Description

Define prefix-infix-suffix command combos

Added to portage

2026-08-16

mailcrypt - 3.5.9-r3
Ebuild name:

app-emacs/mailcrypt-3.5.9-r3

Description

Provides a simple interface to public key cryptography with OpenPGP

Added to portage

2026-08-16

man-pages-ja - 20260815
Ebuild name:

app-i18n/man-pages-ja-20260815

Description

Collection of manual pages translated into Japanese

Added to portage

2026-08-16

marginalia - 2.10
Ebuild name:

app-emacs/marginalia-2.10

Description

Marginalia in the minibuffer

Added to portage

2026-08-16

nanobind - 2.15.0
Ebuild name:

dev-python/nanobind-2.15.0

Description

Tiny and efficient C++/Python bindings

Added to portage

2026-08-16

nauty - 2.9.3
Ebuild name:

sci-mathematics/nauty-2.9.3

Description

Computing automorphism groups of graphs and digraphs

Added to portage

2026-08-16

obs-studio - 32.2.2
Ebuild name:

media-video/obs-studio-32.2.2

Description

Software for Recording and Streaming Live Video Content

Added to portage

2026-08-16

ollama - 0.32.9-r2
Ebuild name:

sci-ml/ollama-0.32.9-r2

Description

Get up and running with Llama 3, Mistral, Gemma, and other language models

Added to portage

2026-08-16

openbsd-netcat - 1.238_p1
Ebuild name:

net-analyzer/openbsd-netcat-1.238_p1

Description

The OpenBSD network swiss army knife

Added to portage

2026-08-16

openrgb - 1.0_rc3
Ebuild name:

app-misc/openrgb-1.0_rc3

Description

Open source RGB lighting control

Added to portage

2026-08-16

podman - 5.8.6
Ebuild name:

app-containers/podman-5.8.6

Description

A tool for managing OCI containers and pods with Docker-compatible CLI

Added to portage

2026-08-16

podman - 6.1.0
Ebuild name:

app-containers/podman-6.1.0

Description

A tool for managing OCI containers and pods with Docker-compatible CLI

Added to portage

2026-08-16

python-json-logger - 4.2.0
Ebuild name:

dev-python/python-json-logger-4.2.0

Description

Standard python logging to output log data as json objects

Added to portage

2026-08-16

pywayland - 0.4.19
Ebuild name:

dev-python/pywayland-0.4.19

Description

Python bindings for the libwayland library

Added to portage

2026-08-16

qemu - 10.2.3-r1
Ebuild name:

app-emulation/qemu-10.2.3-r1

Description

QEMU + Kernel-based Virtual Machine userland tools

Added to portage

2026-08-16

shtab - 1.11.0
Ebuild name:

dev-python/shtab-1.11.0

Description

Automagic shell tab completion for Python CLI applications

Added to portage

2026-08-16

sip - 6.16.1
Ebuild name:

dev-python/sip-6.16.1

Description

Python bindings generator for C/C++ libraries

Added to portage

2026-08-16

tifffile - 2026.8.16
Ebuild name:

dev-python/tifffile-2026.8.16

Description

Read and write TIFF files

Added to portage

2026-08-16

webencodings - 0.6.1
Ebuild name:

dev-python/webencodings-0.6.1

Description

Character encoding aliases for legacy web content

Added to portage

2026-08-16

wrapt - 2.4.0_rc4
Ebuild name:

dev-python/wrapt-2.4.0_rc4

Description

Module for decorators, wrappers and monkey patching

Added to portage

2026-08-16

zabbix - 6.0.48
Ebuild name:

net-analyzer/zabbix-6.0.48

Description

ZABBIX is software for monitoring of your applications, network and serv

Added to portage

2026-08-16

zabbix - 7.0.29
Ebuild name:

net-analyzer/zabbix-7.0.29

Description

ZABBIX is software for monitoring of your applications, network and serv

Added to portage

2026-08-16

zabbix - 7.4.13
Ebuild name:

net-analyzer/zabbix-7.4.13

Description

ZABBIX is software for monitoring of your applications, network and serv

Added to portage

2026-08-16

zip - 3.0_p16
Ebuild name:

app-arch/zip-3.0_p16

Description

Info ZIP (encryption support)

Added to portage

2026-08-16

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