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:

82732

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-01-07
claude-code - 2.0.77
Ebuild name:

dev-util/claude-code-2.0.77

Description

Claude Code - an agentic coding tool by Anthropic

Added to portage

2026-01-07

wget2 - 2.2.1
Ebuild name:

net-misc/wget2-2.2.1

Description

GNU Wget2 is a file and recursive website downloader

Added to portage

2026-01-07

2026-01-06
ada_language_server - 26.0.202504171
Ebuild name:

dev-ada/ada_language_server-26.0.202504171

Description

a Language Server Protocol for Ada/SPARK

Added to portage

2026-01-06

ada_language_server - 26.0.202507020
Ebuild name:

dev-ada/ada_language_server-26.0.202507020

Description

a Language Server Protocol for Ada/SPARK

Added to portage

2026-01-06

ada_language_server - 26.0.202507021
Ebuild name:

dev-ada/ada_language_server-26.0.202507021

Description

a Language Server Protocol for Ada/SPARK

Added to portage

2026-01-06

adifmerg - 20250112
Ebuild name:

media-radio/adifmerg-20250112

Description

A small conversion and check utility for ADIF files

Added to portage

2026-01-06

adifmerg - 9999
Ebuild name:

media-radio/adifmerg-9999

Description

A small conversion and check utility for ADIF files

Added to portage

2026-01-06

awesome - 4.3_p20260105
Ebuild name:

x11-wm/awesome-4.3_p20260105

Description

Dynamic floating and tiling window manager

Added to portage

2026-01-06

awscli - 1.44.12
Ebuild name:

app-admin/awscli-1.44.12

Description

Universal Command Line Environment for AWS

Added to portage

2026-01-06

boto3 - 1.42.22
Ebuild name:

dev-python/boto3-1.42.22

Description

The AWS SDK for Python

Added to portage

2026-01-06

botocore - 1.42.22
Ebuild name:

dev-python/botocore-1.42.22

Description

Low-level, data-driven core of boto 3

Added to portage

2026-01-06

calligraplan - 4.0.0
Ebuild name:

app-office/calligraplan-4.0.0

Description

Project management application

Added to portage

2026-01-06

cfn-lint - 1.43.2
Ebuild name:

dev-python/cfn-lint-1.43.2

Description

CloudFormation Linter

Added to portage

2026-01-06

cmocka - 2.0.1
Ebuild name:

dev-util/cmocka-2.0.1

Description

Unit testing framework for C

Added to portage

2026-01-06

colord - 1.4.8-r1
Ebuild name:

x11-misc/colord-1.4.8-r1

Description

System service to accurately color manage input and output devices

Added to portage

2026-01-06

coreutils - 9.9-r1
Ebuild name:

sys-apps/coreutils-9.9-r1

Description

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

Added to portage

2026-01-06

coreutils - 9.9-r11
Ebuild name:

sys-apps/coreutils-9.9-r11

Description

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

Added to portage

2026-01-06

cyme - 2.2.9
Ebuild name:

sys-apps/cyme-2.2.9

Description

List system USB buses and devices; a modern cross-platform `lsusb`

Added to portage

2026-01-06

dbeaver-bin - 25.3.1-r1
Ebuild name:

dev-db/dbeaver-bin-25.3.1-r1

Description

Free universal database tool (community edition)

Added to portage

2026-01-06

dbeaver-bin - 25.3.2-r1
Ebuild name:

dev-db/dbeaver-bin-25.3.2-r1

Description

Free universal database tool (community edition)

Added to portage

2026-01-06

ddrescue - 1.30
Ebuild name:

sys-fs/ddrescue-1.30

Description

Copy data from one file or block device to another with read-error recovery

Added to portage

2026-01-06

deno-bin - 2.6.4
Ebuild name:

dev-lang/deno-bin-2.6.4

Description

Modern runtime for JavaScript and TypeScript

Added to portage

2026-01-06

django-polymorphic - 4.6.0
Ebuild name:

dev-python/django-polymorphic-4.6.0

Description

Seamless Polymorphic Inheritance for Django Models

Added to portage

2026-01-06

ed - 1.22.4
Ebuild name:

sys-apps/ed-1.22.4

Description

Your basic line editor

Added to portage

2026-01-06

faraday-gzip - 3.1.0
Ebuild name:

dev-ruby/faraday-gzip-3.1.0

Description

Faraday plugin to set compression headers and decompress responses.

Added to portage

2026-01-06

flog - 4.9.3
Ebuild name:

dev-ruby/flog-4.9.3

Description

Flog reports the most tortured code in an easy to read pain report

Added to portage

2026-01-06

gitlab-runner - 18.6.6
Ebuild name:

dev-util/gitlab-runner-18.6.6

Description

The official GitLab Runner, written in Go

Added to portage

2026-01-06

gitlab-runner - 18.7.1
Ebuild name:

dev-util/gitlab-runner-18.7.1

Description

The official GitLab Runner, written in Go

Added to portage

2026-01-06

google-auth - 2.46.0
Ebuild name:

dev-python/google-auth-2.46.0

Description

Google Authentication Library

Added to portage

2026-01-06

hypothesis - 6.149.0
Ebuild name:

dev-python/hypothesis-6.149.0

Description

A library for property based testing

Added to portage

2026-01-06

hypothesis - 6.149.1
Ebuild name:

dev-python/hypothesis-6.149.1

Description

A library for property based testing

Added to portage

2026-01-06

imlib2 - 1.12.6
Ebuild name:

media-libs/imlib2-1.12.6

Description

Version 2 of an advanced replacement library for libraries like libXpm

Added to portage

2026-01-06

imlib2_loaders - 1.12.6
Ebuild name:

media-plugins/imlib2_loaders-1.12.6

Description

Additional image loaders for Imlib2

Added to portage

2026-01-06

ipython - 9.9.0
Ebuild name:

dev-python/ipython-9.9.0

Description

Advanced interactive shell for Python

Added to portage

2026-01-06

kube-apiserver - 1.32.11
Ebuild name:

sys-cluster/kube-apiserver-1.32.11

Description

Kubernetes API server

Added to portage

2026-01-06

kube-controller-manager - 1.32.11
Ebuild name:

sys-cluster/kube-controller-manager-1.32.11

Description

Kubernetes Controller Manager

Added to portage

2026-01-06

kube-proxy - 1.32.11
Ebuild name:

sys-cluster/kube-proxy-1.32.11

Description

Kubernetes Proxy service

Added to portage

2026-01-06

kube-scheduler - 1.32.11
Ebuild name:

sys-cluster/kube-scheduler-1.32.11

Description

Kubernetes Scheduler

Added to portage

2026-01-06

kubeadm - 1.32.11
Ebuild name:

sys-cluster/kubeadm-1.32.11

Description

CLI to Easily bootstrap a secure Kubernetes cluster

Added to portage

2026-01-06

kubectl - 1.32.11
Ebuild name:

sys-cluster/kubectl-1.32.11

Description

CLI to run commands against Kubernetes clusters

Added to portage

2026-01-06

kubelet - 1.32.11
Ebuild name:

sys-cluster/kubelet-1.32.11

Description

Kubernetes Node Agent

Added to portage

2026-01-06

lgi - 0.9.2_p20251219
Ebuild name:

dev-lua/lgi-0.9.2_p20251219

Description

Lua bindings using gobject-introspection

Added to portage

2026-01-06

libarchive - 3.8.5
Ebuild name:

app-arch/libarchive-3.8.5

Description

Multi-format archive and compression library

Added to portage

2026-01-06

lumberjack - 2.0.4
Ebuild name:

dev-ruby/lumberjack-2.0.4

Description

A simple, powerful, and very fast logging utility

Added to portage

2026-01-06

maturin - 1.11.2
Ebuild name:

dev-util/maturin-1.11.2

Description

Build and publish crates with pyo3, rust-cpython and cffi bindings

Added to portage

2026-01-06

mumble - 1.6.0_pre20250920-r2
Ebuild name:

net-voip/mumble-1.6.0_pre20250920-r2

Description

Mumble is an open source, low-latency, high quality voice chat

Added to portage

2026-01-06

murmur - 1.6.0_pre20250920-r3
Ebuild name:

net-voip/murmur-1.6.0_pre20250920-r3

Description

Mumble is an open source, low-latency, high quality voice chat

Added to portage

2026-01-06

openvpn - 2.6.17-r1
Ebuild name:

net-vpn/openvpn-2.6.17-r1

Description

Robust and highly flexible tunneling application compatible with many OSe

Added to portage

2026-01-06

ovpn-dco - 0.2.20251017
Ebuild name:

net-vpn/ovpn-dco-0.2.20251017

Description

OpenVPN Data Channel Offload in the linux kernel

Added to portage

2026-01-06

patatt - 0.7.0-r1
Ebuild name:

dev-python/patatt-0.7.0-r1

Description

A simple library to add cryptographic attestation to patches sent via em

Added to portage

2026-01-06

pathspec - 1.0.0
Ebuild name:

dev-python/pathspec-1.0.0

Description

Utility library for gitignore style pattern matching of file paths

Added to portage

2026-01-06

pcsx2 - 2.6.1
Ebuild name:

games-emulation/pcsx2-2.6.1

Description

PlayStation 2 emulator

Added to portage

2026-01-06

prismlauncher - 9.4-r1
Ebuild name:

games-action/prismlauncher-9.4-r1

Description

Custom, open source Minecraft launcher

Added to portage

2026-01-06

pyasynchat - 1.0.5
Ebuild name:

dev-python/pyasynchat-1.0.5

Description

Make asynchat available for Python 3.12 onwards

Added to portage

2026-01-06

pyasyncore - 1.0.5
Ebuild name:

dev-python/pyasyncore-1.0.5

Description

Make asyncore available for Python 3.12 onwards

Added to portage

2026-01-06

pyshp - 3.0.3
Ebuild name:

sci-libs/pyshp-3.0.3

Description

Pure Python read/write support for ESRI Shapefile format

Added to portage

2026-01-06

pyside - 6.10.1-r4
Ebuild name:

dev-python/pyside-6.10.1-r4

Description

Python bindings for the Qt framework

Added to portage

2026-01-06

ruff - 0.14.10-r1
Ebuild name:

dev-util/ruff-0.14.10-r1

Description

An extremely fast Python linter, written in Rust

Added to portage

2026-01-06

sbctl - 0.16
Ebuild name:

app-crypt/sbctl-0.16

Description

Secure Boot key manager

Added to portage

2026-01-06

sbctl - 0.18
Ebuild name:

app-crypt/sbctl-0.18

Description

Secure Boot key manager

Added to portage

2026-01-06

seatd - 0.9.2
Ebuild name:

sys-auth/seatd-0.9.2

Description

Minimal seat management daemon and universal library

Added to portage

2026-01-06

shadowman - 5
Ebuild name:

dev-util/shadowman-5

Description

Unified compiler shadow link directory updater

Added to portage

2026-01-06

soci - 4.1.2-r2
Ebuild name:

dev-db/soci-4.1.2-r2

Description

SOCI - The C++ Database Access Library

Added to portage

2026-01-06

sudo-rs - 0.2.11-r1
Ebuild name:

app-admin/sudo-rs-0.2.11-r1

Description

A memory safe implementation of sudo and su.

Added to portage

2026-01-06

syncthing - 2.0.13
Ebuild name:

net-p2p/syncthing-2.0.13

Description

Open Source Continuous File Synchronization

Added to portage

2026-01-06

tailscale - 1.92.4
Ebuild name:

net-vpn/tailscale-1.92.4

Description

Tailscale vpn client

Added to portage

2026-01-06

texstudio - 4.9.1
Ebuild name:

app-office/texstudio-4.9.1

Description

Free cross-platform LaTeX editor (fork from texmakerX)

Added to portage

2026-01-06

transmission - 4.1.0_beta5
Ebuild name:

net-p2p/transmission-4.1.0_beta5

Description

A fast, easy, and free BitTorrent client

Added to portage

2026-01-06

udisks - 2.10.2-r1
Ebuild name:

sys-fs/udisks-2.10.2-r1

Description

Daemon providing interfaces to work with storage devices

Added to portage

2026-01-06

udisks - 2.11.0-r1
Ebuild name:

sys-fs/udisks-2.11.0-r1

Description

Daemon providing interfaces to work with storage devices

Added to portage

2026-01-06

upterm - 0.21.0
Ebuild name:

app-misc/upterm-0.21.0

Description

Instant Terminal Sharing

Added to portage

2026-01-06

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