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:

82884

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-21
biboumi - 10.0_pre20260110
Ebuild name:

net-im/biboumi-10.0_pre20260110

Description

XMPP gateway to IRC

Added to portage

2026-01-21

caffe2 - 2.9.1-r3
Ebuild name:

sci-ml/caffe2-2.9.1-r3

Description

A deep learning framework

Added to portage

2026-01-21

less - 691
Ebuild name:

sys-apps/less-691

Description

Excellent text file viewer

Added to portage

2026-01-21

openpgp-keys-inetutils - 20260120
Ebuild name:

sec-keys/openpgp-keys-inetutils-20260120

Description

OpenPGP keys used for net-misc/inetutils

Added to portage

2026-01-21

openpgp-keys-martinlambers - 20260120
Ebuild name:

sec-keys/openpgp-keys-martinlambers-20260120

Description

OpenPGP key used by Martin Lambers

Added to portage

2026-01-21

pytokens - 0.4.0-r1
Ebuild name:

dev-python/pytokens-0.4.0-r1

Description

A fast, spec compliant Python 3.13+ tokenizer that runs on older Pytho

Added to portage

2026-01-21

sslscan - 2.2.1
Ebuild name:

net-analyzer/sslscan-2.2.1

Description

Fast SSL configuration scanner

Added to portage

2026-01-21

tomcat-native - 1.3.5
Ebuild name:

dev-java/tomcat-native-1.3.5

Description

Allows Tomcat to use certain native resources for better performance

Added to portage

2026-01-21

2026-01-20
amq-protocol - 2.5.1
Ebuild name:

dev-ruby/amq-protocol-2.5.1

Description

An AMQP 0.9.1 serialization library for Ruby

Added to portage

2026-01-20

aws-sdk-cpp - 1.11.686-r1
Ebuild name:

dev-cpp/aws-sdk-cpp-1.11.686-r1

Description

AWS SDK for C++

Added to portage

2026-01-20

azure-core - 1.16.2
Ebuild name:

dev-cpp/azure-core-1.16.2

Description

Azure SDK for C++

Added to portage

2026-01-20

azure-identity - 1.13.3
Ebuild name:

dev-cpp/azure-identity-1.13.3

Description

Azure SDK for C++

Added to portage

2026-01-20

blessed - 1.27.0
Ebuild name:

dev-python/blessed-1.27.0

Description

Library for making terminal apps using colors, keyboard input and positio

Added to portage

2026-01-20

busybox - 1.37.0
Ebuild name:

sys-apps/busybox-1.37.0

Description

Utilities for rescue and embedded systems

Added to portage

2026-01-20

candy - 6.1.6
Ebuild name:

net-vpn/candy-6.1.6

Description

A reliable, low-latency, and anti-censorship virtual private network

Added to portage

2026-01-20

claude-code - 2.1.12
Ebuild name:

dev-util/claude-code-2.1.12

Description

Claude Code - an agentic coding tool by Anthropic

Added to portage

2026-01-20

dist-kernel - 5.10.248
Ebuild name:

virtual/dist-kernel-5.10.248

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-01-20

dist-kernel - 5.15.198
Ebuild name:

virtual/dist-kernel-5.15.198

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-01-20

dist-kernel - 6.1.161
Ebuild name:

virtual/dist-kernel-6.1.161

Description

Virtual to depend on any Distribution Kernel

Added to portage

2026-01-20

django-polymorphic - 4.10.4
Ebuild name:

dev-python/django-polymorphic-4.10.4

Description

Seamless Polymorphic Inheritance for Django Models

Added to portage

2026-01-20

fido2 - 2.1.1
Ebuild name:

dev-python/fido2-2.1.1

Description

Python based FIDO 2.0 library

Added to portage

2026-01-20

freerdp - 3.21.0
Ebuild name:

net-misc/freerdp-3.21.0

Description

Free implementation of the Remote Desktop Protocol

Added to portage

2026-01-20

gentoo-kernel - 5.10.248
Ebuild name:

sys-kernel/gentoo-kernel-5.10.248

Description

Linux kernel built with Gentoo patches

Added to portage

2026-01-20

gentoo-kernel - 5.15.198
Ebuild name:

sys-kernel/gentoo-kernel-5.15.198

Description

Linux kernel built with Gentoo patches

Added to portage

2026-01-20

gentoo-kernel - 6.1.161
Ebuild name:

sys-kernel/gentoo-kernel-6.1.161

Description

Linux kernel built with Gentoo patches

Added to portage

2026-01-20

gentoo-kernel-bin - 5.10.248
Ebuild name:

sys-kernel/gentoo-kernel-bin-5.10.248

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-01-20

gentoo-kernel-bin - 5.15.198
Ebuild name:

sys-kernel/gentoo-kernel-bin-5.15.198

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-01-20

gentoo-kernel-bin - 6.1.161
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.1.161

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2026-01-20

gentoo-sources - 5.15.198
Ebuild name:

sys-kernel/gentoo-sources-5.15.198

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-01-20

gentoo-sources - 6.1.161
Ebuild name:

sys-kernel/gentoo-sources-6.1.161

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-01-20

gentoo-sources - 6.12.66
Ebuild name:

sys-kernel/gentoo-sources-6.12.66

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-01-20

gentoo-sources - 6.18.6
Ebuild name:

sys-kernel/gentoo-sources-6.18.6

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-01-20

gentoo-sources - 6.6.121
Ebuild name:

sys-kernel/gentoo-sources-6.6.121

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2026-01-20

git - 4.3.0
Ebuild name:

dev-ruby/git-4.3.0

Description

Library for using Git in Ruby

Added to portage

2026-01-20

glm - 1.0.2
Ebuild name:

media-libs/glm-1.0.2

Description

OpenGL Mathematics

Added to portage

2026-01-20

gnucash - 5.14
Ebuild name:

app-office/gnucash-5.14

Description

Personal finance manager

Added to portage

2026-01-20

gopls - 0.21.0
Ebuild name:

dev-go/gopls-0.21.0

Description

Added to portage

2026-01-20

inetutils - 2.7
Ebuild name:

net-misc/inetutils-2.7

Description

Collection of common network programs

Added to portage

2026-01-20

isort - 7.0.0-r1
Ebuild name:

dev-python/isort-7.0.0-r1

Description

A python utility/library to sort imports

Added to portage

2026-01-20

jellyfin-bin - 10.11.6
Ebuild name:

www-apps/jellyfin-bin-10.11.6

Description

Jellyfin puts you in control of managing and streaming your media

Added to portage

2026-01-20

keystoneauth1 - 5.13.0
Ebuild name:

dev-python/keystoneauth1-5.13.0

Description

This package contains tools for authenticating to an OpenStack-base

Added to portage

2026-01-20

kramdown - 2.5.2
Ebuild name:

dev-ruby/kramdown-2.5.2

Description

Yet-another-markdown-parser but fast, pure Ruby, using strict syntax defini

Added to portage

2026-01-20

libfilezilla - 0.54.0
Ebuild name:

dev-libs/libfilezilla-0.54.0

Description

C++ library offering some basic functionality for platform-independent

Added to portage

2026-01-20

mattermost-desktop-bin - 6.0.4
Ebuild name:

net-im/mattermost-desktop-bin-6.0.4

Description

Mattermost Desktop application

Added to portage

2026-01-20

mkdocstrings - 1.0.1
Ebuild name:

dev-python/mkdocstrings-1.0.1

Description

Automatic documentation from sources, for MkDocs

Added to portage

2026-01-20

multiprocess - 0.70.19
Ebuild name:

dev-python/multiprocess-0.70.19

Description

Better multiprocessing and multithreading in Python

Added to portage

2026-01-20

nagios-plugins - 2.4.12-r4
Ebuild name:

net-analyzer/nagios-plugins-2.4.12-r4

Description

Official plugins for Nagios

Added to portage

2026-01-20

nushell - 0.110.0
Ebuild name:

app-shells/nushell-0.110.0

Description

A new type of shell, written in Rust

Added to portage

2026-01-20

openhab-bin - 5.1.1
Ebuild name:

app-misc/openhab-bin-5.1.1

Description

An open-source automation software for your home

Added to portage

2026-01-20

openpgp-keys-martinmares - 20260120
Ebuild name:

sec-keys/openpgp-keys-martinmares-20260120

Description

OpenPGP key used by Martin Mareš

Added to portage

2026-01-20

openpgp-keys-pevik - 20260120
Ebuild name:

sec-keys/openpgp-keys-pevik-20260120

Description

OpenPGP key used by Petr Vorel (pevik)

Added to portage

2026-01-20

openstacksdk - 4.9.0
Ebuild name:

dev-python/openstacksdk-4.9.0

Description

A collection of libraries for building applications to work with Open

Added to portage

2026-01-20

pidgin-led-notification - 0.1-r3
Ebuild name:

x11-plugins/pidgin-led-notification-0.1-r3

Description

Pidgin plugin to notify by writing user defined strings

Added to portage

2026-01-20

pixi - 0.63.2
Ebuild name:

dev-util/pixi-0.63.2

Description

A package management and workflow tool

Added to portage

2026-01-20

pylast - 7.0.2
Ebuild name:

dev-python/pylast-7.0.2

Description

Python interface to last.fm and other api-compatible websites

Added to portage

2026-01-20

pylint - 4.0.4-r1
Ebuild name:

dev-python/pylint-4.0.4-r1

Description

Python code static checker

Added to portage

2026-01-20

qpdf - 12.3.1
Ebuild name:

app-text/qpdf-12.3.1

Description

Command-line tool for structural, content-preserving transformation of PDF fil

Added to portage

2026-01-20

scdrand - 0.3.5
Ebuild name:

app-crypt/scdrand-0.3.5

Description

Feed kernel entropy pool from smartcard's TRNG

Added to portage

2026-01-20

selenium-webdriver - 4.40.0
Ebuild name:

dev-ruby/selenium-webdriver-4.40.0

Description

This gem provides Ruby bindings for WebDriver

Added to portage

2026-01-20

shadow - 4.19.2
Ebuild name:

sys-apps/shadow-4.19.2

Description

Utilities to deal with user accounts

Added to portage

2026-01-20

stalwart-cli - 0.15.4
Ebuild name:

net-mail/stalwart-cli-0.15.4

Description

Stalwart Mail Server command line utility

Added to portage

2026-01-20

stalwart-mail - 0.15.4
Ebuild name:

net-mail/stalwart-mail-0.15.4

Description

Stalwart Mail Server

Added to portage

2026-01-20

stestr - 4.2.0-r1
Ebuild name:

dev-python/stestr-4.2.0-r1

Description

A parallel Python test runner built around subunit

Added to portage

2026-01-20

vanilla-kernel - 5.10.248
Ebuild name:

sys-kernel/vanilla-kernel-5.10.248

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-01-20

vanilla-kernel - 5.15.198
Ebuild name:

sys-kernel/vanilla-kernel-5.15.198

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-01-20

vanilla-kernel - 6.1.161
Ebuild name:

sys-kernel/vanilla-kernel-6.1.161

Description

Linux kernel built from vanilla upstream sources

Added to portage

2026-01-20

vanilla-sources - 5.10.248
Ebuild name:

sys-kernel/vanilla-sources-5.10.248

Description

Full sources for the Linux kernel

Added to portage

2026-01-20

vanilla-sources - 5.15.198
Ebuild name:

sys-kernel/vanilla-sources-5.15.198

Description

Full sources for the Linux kernel

Added to portage

2026-01-20

vanilla-sources - 6.1.161
Ebuild name:

sys-kernel/vanilla-sources-6.1.161

Description

Full sources for the Linux kernel

Added to portage

2026-01-20

vanilla-sources - 6.12.66
Ebuild name:

sys-kernel/vanilla-sources-6.12.66

Description

Full sources for the Linux kernel

Added to portage

2026-01-20

vanilla-sources - 6.18.6
Ebuild name:

sys-kernel/vanilla-sources-6.18.6

Description

Full sources for the Linux kernel

Added to portage

2026-01-20

vanilla-sources - 6.6.121
Ebuild name:

sys-kernel/vanilla-sources-6.6.121

Description

Full sources for the Linux kernel

Added to portage

2026-01-20

weasyprint - 68.0
Ebuild name:

dev-python/weasyprint-68.0

Description

Visual rendering engine for HTML and CSS that can export to PDF

Added to portage

2026-01-20

wesnoth - 1.18.6
Ebuild name:

games-strategy/wesnoth-1.18.6

Description

Battle for Wesnoth - A fantasy turn-based strategy game

Added to portage

2026-01-20

wesnoth - 1.19.19
Ebuild name:

games-strategy/wesnoth-1.19.19

Description

Battle for Wesnoth - A fantasy turn-based strategy game

Added to portage

2026-01-20

winbox - 4.0_beta47
Ebuild name:

app-admin/winbox-4.0_beta47

Description

Management Software for MikroTik RouterOS

Added to portage

2026-01-20

zellij - 0.43.1-r1
Ebuild name:

app-misc/zellij-0.43.1-r1

Description

A terminal workspace with batteries included

Added to portage

2026-01-20

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