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:

83856

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-21
autoconf - 2.73
Ebuild name:

dev-build/autoconf-2.73

Description

Used to create autoconfiguration files

Added to portage

2026-03-21

autoconf-wrapper - 20260320
Ebuild name:

dev-build/autoconf-wrapper-20260320

Description

Wrapper for autoconf to manage multiple autoconf versions

Added to portage

2026-03-21

eselect - 1.4.32
Ebuild name:

app-admin/eselect-1.4.32

Description

Gentoo's multi-purpose configuration and management tool

Added to portage

2026-03-21

libhtp - 0.5.53
Ebuild name:

net-libs/libhtp-0.5.53

Description

Security-aware parser for the HTTP protocol and the related bits and pieces

Added to portage

2026-03-21

mesa - 26.0.3
Ebuild name:

media-libs/mesa-26.0.3

Description

OpenGL-like graphic library for Linux

Added to portage

2026-03-21

mesa_clc - 26.0.3
Ebuild name:

dev-util/mesa_clc-26.0.3

Description

mesa_clc tool used for building OpenCL C to SPIR-V

Added to portage

2026-03-21

multiple-cursors - 1.5.0
Ebuild name:

app-emacs/multiple-cursors-1.5.0

Description

Multiple cursors for Emacs

Added to portage

2026-03-21

muse - 3.20.2
Ebuild name:

app-emacs/muse-3.20.2

Description

An authoring and publishing environment for Emacs

Added to portage

2026-03-21

musl - 1.2.6
Ebuild name:

sys-libs/musl-1.2.6

Description

Light, fast and, simple C library focused on standards-conformance and safety

Added to portage

2026-03-21

openpgp-keys-oisf - 20260319
Ebuild name:

sec-keys/openpgp-keys-oisf-20260319

Description

OpenPGP key used by Open InfoSec Foundation (OISF) software rel

Added to portage

2026-03-21

suricata - 7.0.15
Ebuild name:

net-analyzer/suricata-7.0.15

Description

High performance Network IDS, IPS and Network Security Monitoring engi

Added to portage

2026-03-21

systemd - 260-r1
Ebuild name:

sys-apps/systemd-260-r1

Description

System and service manager for Linux

Added to portage

2026-03-21

systemd-utils - 260
Ebuild name:

sys-apps/systemd-utils-260

Description

Utilities split out from systemd for OpenRC users

Added to portage

2026-03-21

vit - 2.3.4
Ebuild name:

app-misc/vit-2.3.4

Description

A lightweight, fast, curses-based front end to Taskwarrior

Added to portage

2026-03-21

wayland - 1.25.0
Ebuild name:

dev-libs/wayland-1.25.0

Description

Wayland protocol libraries

Added to portage

2026-03-21

wayland-scanner - 1.25.0
Ebuild name:

dev-util/wayland-scanner-1.25.0

Description

wayland-scanner tool

Added to portage

2026-03-21

2026-03-20
accel-ppp - 1.14.0-r2
Ebuild name:

net-dialup/accel-ppp-1.14.0-r2

Description

High performance PPTP/L2TP/SSTP/PPPoE/IPoE server

Added to portage

2026-03-20

attrs - 26.1.0
Ebuild name:

dev-python/attrs-26.1.0

Description

Attributes without boilerplate

Added to portage

2026-03-20

awscli - 1.44.62
Ebuild name:

app-admin/awscli-1.44.62

Description

Universal Command Line Environment for AWS

Added to portage

2026-03-20

boto3 - 1.42.72
Ebuild name:

dev-python/boto3-1.42.72

Description

The AWS SDK for Python

Added to portage

2026-03-20

botocore - 1.42.72
Ebuild name:

dev-python/botocore-1.42.72

Description

Low-level, data-driven core of boto 3

Added to portage

2026-03-20

chibi - 0.12
Ebuild name:

dev-scheme/chibi-0.12

Description

Minimal Scheme implementation for use as an extension language

Added to portage

2026-03-20

coreutils - 9.9-r12
Ebuild name:

sys-apps/coreutils-9.9-r12

Description

Standard GNU utilities (chmod, cp, dd, ls, sort, tr, head, wc, who,...)

Added to portage

2026-03-20

deno-bin - 2.7.7
Ebuild name:

dev-lang/deno-bin-2.7.7

Description

Modern runtime for JavaScript and TypeScript

Added to portage

2026-03-20

discord - 0.0.129
Ebuild name:

net-im/discord-0.0.129

Description

All-in-one voice and text chat for gamers

Added to portage

2026-03-20

dist-kernel - 6.18.19
Ebuild name:

virtual/dist-kernel-6.18.19

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-03-20

dist-kernel - 6.19.9
Ebuild name:

virtual/dist-kernel-6.19.9

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-03-20

gallery-dl - 1.31.10
Ebuild name:

net-misc/gallery-dl-1.31.10

Description

Download image galleries and collections from several image hosting sit

Added to portage

2026-03-20

gentoo-kernel - 6.18.19
Ebuild name:

sys-kernel/gentoo-kernel-6.18.19

Description

Linux kernel built with Gentoo patches

Added to portage

2026-03-20

gentoo-kernel - 6.19.9
Ebuild name:

sys-kernel/gentoo-kernel-6.19.9

Description

Linux kernel built with Gentoo patches

Added to portage

2026-03-20

gentoo-kernel-bin - 6.18.19
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.18.19

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-03-20

gentoo-kernel-bin - 6.19.9
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.19.9

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-03-20

gentoo-sources - 6.18.19
Ebuild name:

sys-kernel/gentoo-sources-6.18.19

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-03-20

gentoo-sources - 6.19.9
Ebuild name:

sys-kernel/gentoo-sources-6.19.9

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-03-20

gmpy2 - 2.4.0_alpha0
Ebuild name:

dev-python/gmpy2-2.4.0_alpha0

Description

Python bindings for GMP, MPC, MPFR and MPIR libraries

Added to portage

2026-03-20

godot - 4.5.2
Ebuild name:

dev-games/godot-4.5.2

Description

Multi-platform 2D and 3D game engine with a feature-rich editor

Added to portage

2026-03-20

haproxy - 2.8.20
Ebuild name:

net-proxy/haproxy-2.8.20

Description

A TCP/HTTP reverse proxy for high availability environments

Added to portage

2026-03-20

haproxy - 3.0.19
Ebuild name:

net-proxy/haproxy-3.0.19

Description

A TCP/HTTP reverse proxy for high availability environments

Added to portage

2026-03-20

haproxy - 3.2.15
Ebuild name:

net-proxy/haproxy-3.2.15

Description

A TCP/HTTP reverse proxy for high availability environments

Added to portage

2026-03-20

importlib-metadata - 8.8.0
Ebuild name:

dev-python/importlib-metadata-8.8.0

Description

Read metadata from Python packages

Added to portage

2026-03-20

jingoo - 1.5.2
Ebuild name:

dev-ml/jingoo-1.5.2

Description

OCaml template engine almost compatible with Jinja2

Added to portage

2026-03-20

keychain - 2.9.8
Ebuild name:

net-misc/keychain-2.9.8

Description

Agent manager for OpenSSH, ssh.com, Sun SSH, and GnuPG

Added to portage

2026-03-20

mpc - 1.4.0
Ebuild name:

dev-libs/mpc-1.4.0

Description

A library for multiprecision complex arithmetic with exact rounding

Added to portage

2026-03-20

nitrocli - 0.4.1-r2
Ebuild name:

app-crypt/nitrocli-0.4.1-r2

Description

A command line tool for interacting with Nitrokey devices

Added to portage

2026-03-20

nwipe - 0.39
Ebuild name:

app-crypt/nwipe-0.39

Description

Securely erase disks using a variety of recognized methods

Added to portage

2026-03-20

pandoc-bin - 3.9.0.2
Ebuild name:

app-text/pandoc-bin-3.9.0.2

Description

Conversion between markup formats (binary package)

Added to portage

2026-03-20

pipdeptree - 2.32.0
Ebuild name:

dev-python/pipdeptree-2.32.0

Description

Utility for displaying installed packages in a dependency tree

Added to portage

2026-03-20

pwsh - 7.6
Ebuild name:

virtual/pwsh-7.6

Description

Virtual for PowerShell

Added to portage

2026-03-20

pwsh - 7.6.0
Ebuild name:

app-shells/pwsh-7.6.0

Description

Cross-platform automation and configuration tool

Added to portage

2026-03-20

pwsh-bin - 7.6.0
Ebuild name:

app-shells/pwsh-bin-7.6.0

Description

Cross-platform automation and configuration tool (binary package)

Added to portage

2026-03-20

pysubs2 - 1.8.1
Ebuild name:

dev-python/pysubs2-1.8.1

Description

Python library for editing subtitle files

Added to portage

2026-03-20

ruff - 0.15.7
Ebuild name:

dev-util/ruff-0.15.7

Description

An extremely fast Python linter, written in Rust

Added to portage

2026-03-20

sabctools - 9.4.0
Ebuild name:

dev-python/sabctools-9.4.0

Description

Module providing raw yEnc encoding/decoding for SABnzbd

Added to portage

2026-03-20

scitokens-cpp - 1.4.1
Ebuild name:

dev-cpp/scitokens-cpp-1.4.1

Description

C++ implementation of the SciTokens library with a C library interface

Added to portage

2026-03-20

setuptools-scm - 10.0.1
Ebuild name:

dev-python/setuptools-scm-10.0.1

Description

Manage versions by scm tags via setuptools

Added to portage

2026-03-20

shell-maker - 0.89.2
Ebuild name:

app-emacs/shell-maker-0.89.2

Description

Interaction mode for making comint shells for GNU Emacs

Added to portage

2026-03-20

simdjson - 4.4.2
Ebuild name:

dev-libs/simdjson-4.4.2

Description

SIMD accelerated C++ JSON library

Added to portage

2026-03-20

systemd-initctl - 4
Ebuild name:

sys-apps/systemd-initctl-4

Description

initctl Compatibility Daemon

Added to portage

2026-03-20

tox - 4.50.3
Ebuild name:

dev-python/tox-4.50.3

Description

virtualenv-based automation of test activities

Added to portage

2026-03-20

unifi - 10.1.89
Ebuild name:

net-wireless/unifi-10.1.89

Description

A Management Controller for Ubiquiti Networks UniFi APs

Added to portage

2026-03-20

uv - 0.10.12
Ebuild name:

dev-python/uv-0.10.12

Description

A Python package installer and resolver, written in Rust

Added to portage

2026-03-20

uv-build - 0.10.12
Ebuild name:

dev-python/uv-build-0.10.12

Description

PEP517 uv build backend

Added to portage

2026-03-20

vanilla-kernel - 6.18.19
Ebuild name:

sys-kernel/vanilla-kernel-6.18.19

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-03-20

vanilla-kernel - 6.19.9
Ebuild name:

sys-kernel/vanilla-kernel-6.19.9

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-03-20

vcs-versioning - 1.0.1
Ebuild name:

dev-python/vcs-versioning-1.0.1

Description

Core VCS versioning functionality from setuptools-scm

Added to portage

2026-03-20

vivaldi - 7.9.3970.39
Ebuild name:

www-client/vivaldi-7.9.3970.39

Description

A browser for our friends

Added to portage

2026-03-20

whenever - 0.10.0_alpha1
Ebuild name:

dev-python/whenever-0.10.0_alpha1

Description

Modern datetime library for Python

Added to portage

2026-03-20

whois - 5.6.6
Ebuild name:

net-misc/whois-5.6.6

Description

Improved Whois Client

Added to portage

2026-03-20

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