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:

87070

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-07-21
container-libs - 0.68.0-r1
Ebuild name:

app-containers/container-libs-0.68.0-r1

Description

Several utilities from the containers project

Added to portage

2026-07-21

containers-shortnames - 2025.03.19_p20260615
Ebuild name:

app-containers/containers-shortnames-2025.03.19_p20260615

Description

Configures default shortnames (aliases) f

Added to portage

2026-07-21

dkms - 3.4.2
Ebuild name:

sys-kernel/dkms-3.4.2

Description

Dynamic Kernel Module Support

Added to portage

2026-07-21

dracut - 111-r2
Ebuild name:

sys-kernel/dracut-111-r2

Description

Generic initramfs generation tool

Added to portage

2026-07-21

firefox - 153.0
Ebuild name:

www-client/firefox-153.0

Description

Firefox Web Browser

Added to portage

2026-07-21

firefox-l10n - 153.0
Ebuild name:

www-client/firefox-l10n-153.0

Description

Firefox Web Browser's translation files

Added to portage

2026-07-21

fuse-overlayfs - 1.17
Ebuild name:

sys-fs/fuse-overlayfs-1.17

Description

FUSE implementation for overlayfs

Added to portage

2026-07-21

ggml - 0.17.0
Ebuild name:

sci-ml/ggml-0.17.0

Description

Tensor library for machine learning

Added to portage

2026-07-21

ophcrack - 3.8.0-r2
Ebuild name:

app-crypt/ophcrack-3.8.0-r2

Description

A time-memory-trade-off-cracker

Added to portage

2026-07-21

ophcrack-tables - 1.0-r2
Ebuild name:

app-crypt/ophcrack-tables-1.0-r2

Description

Tables available for ophcrack

Added to portage

2026-07-21

osslsigncode - 2.13
Ebuild name:

app-crypt/osslsigncode-2.13

Description

Platform-independent tool for Authenticode signing of EXE/CAB files

Added to portage

2026-07-21

osslsigncode - 2.9
Ebuild name:

app-crypt/osslsigncode-2.9

Description

Platform-independent tool for Authenticode signing of EXE/CAB files

Added to portage

2026-07-21

p11-kit - 0.26.2
Ebuild name:

app-crypt/p11-kit-0.26.2

Description

Provides a standard configuration setup for installing PKCS11

Added to portage

2026-07-21

p11-kit - 0.26.4
Ebuild name:

app-crypt/p11-kit-0.26.4

Description

Provides a standard configuration setup for installing PKCS11

Added to portage

2026-07-21

paperkey - 1.6
Ebuild name:

app-crypt/paperkey-1.6

Description

OpenPGP key archiver

Added to portage

2026-07-21

passt - 2026.07.16
Ebuild name:

net-misc/passt-2026.07.16

Description

User-mode networking daemons for VMs and namespaces, replacement for Slir

Added to portage

2026-07-21

podman - 5.8.5
Ebuild name:

app-containers/podman-5.8.5

Description

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

Added to portage

2026-07-21

podman - 6.0.1
Ebuild name:

app-containers/podman-6.0.1

Description

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

Added to portage

2026-07-21

podman-tui - 1.11.3
Ebuild name:

app-containers/podman-tui-1.11.3

Description

Terminal UI frontend for Podman

Added to portage

2026-07-21

prometheus-podman-exporter - 1.21.2
Ebuild name:

app-metrics/prometheus-podman-exporter-1.21.2

Description

Exporter for podman giving containers, pods, images,

Added to portage

2026-07-21

pyqtgraph - 0.14.0-r1
Ebuild name:

dev-python/pyqtgraph-0.14.0-r1

Description

A pure-python graphics and GUI library built on PyQt and numpy

Added to portage

2026-07-21

2026-07-20
acme-sh - 3.1.4
Ebuild name:

app-crypt/acme-sh-3.1.4

Description

A pure Unix shell script implementing ACME client protocol

Added to portage

2026-07-20

aws-c-auth - 0.10.4
Ebuild name:

dev-libs/aws-c-auth-0.10.4

Description

AWS C Auth C99 library implementation of AWS client-side authentication

Added to portage

2026-07-20

aws-c-cal - 0.9.14
Ebuild name:

dev-libs/aws-c-cal-0.9.14

Description

Crypto Abstraction Layer Cross-Platform C99 wrapper for cryptography prim

Added to portage

2026-07-20

aws-c-common - 0.14.2
Ebuild name:

dev-libs/aws-c-common-0.14.2

Description

Core c99 package for AWS SDK for C

Added to portage

2026-07-20

aws-c-compression - 0.3.2
Ebuild name:

dev-libs/aws-c-compression-0.3.2

Description

AWS C Compression cross-platform algorithms

Added to portage

2026-07-20

aws-c-event-stream - 0.7.1
Ebuild name:

dev-libs/aws-c-event-stream-0.7.1

Description

Core c99 package for AWS SDK for C

Added to portage

2026-07-20

aws-c-http - 0.11.0
Ebuild name:

dev-libs/aws-c-http-0.11.0

Description

AWS C Http C99 implementation of the HTTP/1.1 and HTTP/2 specifications

Added to portage

2026-07-20

aws-c-io - 0.27.4
Ebuild name:

dev-libs/aws-c-io-0.27.4

Description

AWS C IO It handles all IO and TLS work for application protocols

Added to portage

2026-07-20

aws-c-mqtt - 0.16.0
Ebuild name:

dev-libs/aws-c-mqtt-0.16.0

Description

AWS C MQTT C99 implementation

Added to portage

2026-07-20

aws-c-s3 - 0.13.1
Ebuild name:

dev-libs/aws-c-s3-0.13.1

Description

AWS C S3 async library

Added to portage

2026-07-20

aws-c-sdkutils - 0.2.7
Ebuild name:

dev-libs/aws-c-sdkutils-0.2.7

Description

AWS C SDKUTILS C99 library implementing AWS SDK specific utilities

Added to portage

2026-07-20

aws-checksums - 0.2.10
Ebuild name:

dev-libs/aws-checksums-0.2.10

Description

Cross-Platform HW accelerated CRC32c and CRC32 with fallback to SW

Added to portage

2026-07-20

aws-crt-cpp - 0.37.4
Ebuild name:

dev-cpp/aws-crt-cpp-0.37.4

Description

C++ wrapper around the aws-c-* libraries

Added to portage

2026-07-20

aws-sdk-cpp - 1.11.764
Ebuild name:

dev-cpp/aws-sdk-cpp-1.11.764

Description

AWS SDK for C++

Added to portage

2026-07-20

below - 9999
Ebuild name:

sys-process/below-9999

Description

An interactive tool to view and record historical system data

Added to portage

2026-07-20

bitarray - 3.9.1
Ebuild name:

dev-python/bitarray-3.9.1

Description

Efficient arrays of booleans -- C extension

Added to portage

2026-07-20

confuse - 2.2.1
Ebuild name:

dev-python/confuse-2.2.1

Description

Confuse is a configuration library for Python that uses YAML

Added to portage

2026-07-20

dulwich - 1.2.12
Ebuild name:

dev-python/dulwich-1.2.12

Description

Pure-Python implementation of the Git file formats and protocols

Added to portage

2026-07-20

faust-cchardet - 2.2.1
Ebuild name:

dev-python/faust-cchardet-2.2.1

Description

High speed universal character encoding detector

Added to portage

2026-07-20

firefox-bin - 153.0
Ebuild name:

www-client/firefox-bin-153.0

Description

Firefox Web Browser

Added to portage

2026-07-20

fractal - 14.1
Ebuild name:

net-im/fractal-14.1

Description

Matrix messaging app for GNOME written in Rust

Added to portage

2026-07-20

gcc - 17.0.0_p20260719
Ebuild name:

sys-devel/gcc-17.0.0_p20260719

Description

The GNU Compiler Collection

Added to portage

2026-07-20

gherkin-official - 42.0.0
Ebuild name:

dev-python/gherkin-official-42.0.0

Description

Gherkin parser/compiler for Python

Added to portage

2026-07-20

git-sources - 7.2_rc4
Ebuild name:

sys-kernel/git-sources-7.2_rc4

Description

The very latest -git version of the Linux kernel

Added to portage

2026-07-20

gpredict - 2.5.2
Ebuild name:

media-radio/gpredict-2.5.2

Description

Real-time satellite tracking and orbit prediction application

Added to portage

2026-07-20

gulrak-filesystem - 1.5.16
Ebuild name:

dev-cpp/gulrak-filesystem-1.5.16

Description

Header-only single-file std compatible helper library

Added to portage

2026-07-20

helvum - 0.6.2
Ebuild name:

media-sound/helvum-0.6.2

Description

A GTK patchbay for pipewire

Added to portage

2026-07-20

htop - 3.5.2
Ebuild name:

sys-process/htop-3.5.2

Description

Interactive process viewer

Added to portage

2026-07-20

hypothesis - 6.157.0
Ebuild name:

dev-python/hypothesis-6.157.0

Description

A library for property based testing

Added to portage

2026-07-20

joserfc - 1.7.4
Ebuild name:

dev-python/joserfc-1.7.4

Description

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

Added to portage

2026-07-20

jupyter-builder - 1.1.1-r1
Ebuild name:

dev-python/jupyter-builder-1.1.1-r1

Description

JupyterLab build tools

Added to portage

2026-07-20

kddockwidgets - 2.4.1
Ebuild name:

gui-libs/kddockwidgets-2.4.1

Description

KDAB's Dock Widget Framework for Qt

Added to portage

2026-07-20

libxmp - 4.7.1
Ebuild name:

media-libs/libxmp-4.7.1

Description

Library that renders module files to PCM data

Added to portage

2026-07-20

lowdown - 3.1.1
Ebuild name:

app-text/lowdown-3.1.1

Description

Markdown translator producing HTML5, roff documents in the ms and man format

Added to portage

2026-07-20

mpd - 0.24.12-r1
Ebuild name:

media-sound/mpd-0.24.12-r1

Description

The Music Player Daemon (mpd)

Added to portage

2026-07-20

onak - 0.6.4
Ebuild name:

app-crypt/onak-0.6.4

Description

onak is an OpenPGP keyserver

Added to portage

2026-07-20

openrdap - 0.10.1
Ebuild name:

net-misc/openrdap-0.10.1

Description

RDAP command line client

Added to portage

2026-07-20

pebble - 5.2.1
Ebuild name:

dev-python/pebble-5.2.1

Description

Threading and multiprocessing eye-candy

Added to portage

2026-07-20

postfix - 3.12_pre20260716
Ebuild name:

mail-mta/postfix-3.12_pre20260716

Description

A fast and secure drop-in replacement for sendmail

Added to portage

2026-07-20

pyshp - 3.1.4
Ebuild name:

sci-libs/pyshp-3.1.4

Description

Pure Python read/write support for ESRI Shapefile format

Added to portage

2026-07-20

ruff - 0.15.22
Ebuild name:

dev-util/ruff-0.15.22

Description

An extremely fast Python linter, written in Rust

Added to portage

2026-07-20

sdl2-mixer - 2.8.1-r4
Ebuild name:

media-libs/sdl2-mixer-2.8.1-r4

Description

Simple Direct Media Layer Mixer Library

Added to portage

2026-07-20

sdl2-mixer - 2.8.2-r1
Ebuild name:

media-libs/sdl2-mixer-2.8.2-r1

Description

Simple Direct Media Layer Mixer Library

Added to portage

2026-07-20

soupsieve - 2.9
Ebuild name:

dev-python/soupsieve-2.9

Description

A modern CSS selector implementation for BeautifulSoup

Added to portage

2026-07-20

stb - 20260415-r1
Ebuild name:

dev-libs/stb-20260415-r1

Description

Single-file C/C++ libraries for various purposes

Added to portage

2026-07-20

term-ansicolor - 1.11.3-r1
Ebuild name:

dev-ruby/term-ansicolor-1.11.3-r1

Description

Small Ruby library that colors strings using ANSI escape sequence

Added to portage

2026-07-20

winbox - 4.3
Ebuild name:

app-admin/winbox-4.3

Description

Management Software for MikroTik RouterOS

Added to portage

2026-07-20

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