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:

89559

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-10-26
aria2 - 1.37.0-r1
Ebuild name:

net-misc/aria2-1.37.0-r1

Description

A download utility with segmented downloading with BitTorrent support

Added to portage

2026-10-26

curl - 8.23.0-r1
Ebuild name:

net-misc/curl-8.23.0-r1

Description

A Client that groks URLs

Added to portage

2026-10-26

gawk - 5.4.1c
Ebuild name:

sys-apps/gawk-5.4.1c

Description

GNU awk pattern-matching language

Added to portage

2026-10-26

johntheripper - 1.8.0-r2
Ebuild name:

app-crypt/johntheripper-1.8.0-r2

Description

fast password cracker

Added to portage

2026-10-26

johntheripper - 1.9.0
Ebuild name:

app-crypt/johntheripper-1.9.0

Description

fast password cracker

Added to portage

2026-10-26

johntheripper-jumbo - 1.9.0_p20240102
Ebuild name:

app-crypt/johntheripper-jumbo-1.9.0_p20240102

Description

Fast password cracker, community enhanced version

Added to portage

2026-10-26

johntheripper-jumbo - 1.9.0_p20250216-r1
Ebuild name:

app-crypt/johntheripper-jumbo-1.9.0_p20250216-r1

Description

Fast password cracker, community enhanced version

Added to portage

2026-10-26

johntheripper-jumbo - 1.9.0_p20250703
Ebuild name:

app-crypt/johntheripper-jumbo-1.9.0_p20250703

Description

Fast password cracker, community enhanced version

Added to portage

2026-10-26

johntheripper-jumbo - 9999
Ebuild name:

app-crypt/johntheripper-jumbo-9999

Description

Fast password cracker, community enhanced version

Added to portage

2026-10-26

kali-archive-keyring - 2020.2
Ebuild name:

app-crypt/kali-archive-keyring-2020.2

Description

GnuPG archive keys of the Kali archive

Added to portage

2026-10-26

kbfs - 6.0.2
Ebuild name:

app-crypt/kbfs-6.0.2

Description

Keybase Filesystem (KBFS)

Added to portage

2026-10-26

kbfs - 6.2.4
Ebuild name:

app-crypt/kbfs-6.2.4

Description

Keybase Filesystem (KBFS)

Added to portage

2026-10-26

language-c - 0.10.2
Ebuild name:

dev-haskell/language-c-0.10.2

Description

Analysis and generation of C code

Added to portage

2026-10-26

openssh-legacy - 9.9_p2-r1
Ebuild name:

net-misc/openssh-legacy-9.9_p2-r1

Description

Old versions of OpenSSH installed separately for legacy machines

Added to portage

2026-10-26

systemd - 262.1
Ebuild name:

sys-apps/systemd-262.1

Description

System and service manager for Linux

Added to portage

2026-10-26

tls - 2.0.1
Ebuild name:

dev-tcltk/tls-2.0.1

Description

TLS OpenSSL extension to Tcl

Added to portage

2026-10-26

2026-10-25
amf-headers - 1.5.2
Ebuild name:

media-libs/amf-headers-1.5.2

Description

The Advanced Media Framework (AMF) SDK

Added to portage

2026-10-25

apprise - 2.1.0
Ebuild name:

dev-python/apprise-2.1.0

Description

Push Notifications that work with just about every platform

Added to portage

2026-10-25

berkeleydb - 18.1.17
Ebuild name:

dev-python/berkeleydb-18.1.17

Description

Python bindings for Oracle Berkeley DB

Added to portage

2026-10-25

capnproto - 1.5.0
Ebuild name:

dev-libs/capnproto-1.5.0

Description

RPC/Serialization system with capabilities support

Added to portage

2026-10-25

cmd2 - 4.3.1
Ebuild name:

dev-python/cmd2-4.3.1

Description

Extra features for standard library's cmd module

Added to portage

2026-10-25

discord - 1.0.166
Ebuild name:

net-im/discord-1.0.166

Description

All-in-one voice and text chat for gamers

Added to portage

2026-10-25

efitools - 1.9.2_p1
Ebuild name:

app-crypt/efitools-1.9.2_p1

Description

Tools for manipulating UEFI secure boot platforms

Added to portage

2026-10-25

electrum - 4.8.3
Ebuild name:

net-misc/electrum-4.8.3

Description

User friendly Bitcoin client

Added to portage

2026-10-25

gallery-dl - 1.32.17-r1
Ebuild name:

net-misc/gallery-dl-1.32.17-r1

Description

Download image galleries and collections from several image hosting

Added to portage

2026-10-25

gallery-dl - 1.32.18
Ebuild name:

net-misc/gallery-dl-1.32.18

Description

Download image galleries and collections from several image hosting sit

Added to portage

2026-10-25

git - 2.56.0-r1
Ebuild name:

dev-vcs/git-2.56.0-r1

Description

Stupid content tracker distributed VCS designed for speed and efficiency

Added to portage

2026-10-25

gnupg - 2.5.24-r2
Ebuild name:

app-crypt/gnupg-2.5.24-r2

Description

The GNU Privacy Guard, a GPL OpenPGP implementation

Added to portage

2026-10-25

icu4j - 79.1
Ebuild name:

dev-java/icu4j-79.1

Description

A set of Java libraries providing Unicode and Globalization support

Added to portage

2026-10-25

isync - 1.5.1-r1
Ebuild name:

net-mail/isync-1.5.1-r1

Description

MailDir mailbox synchronizer

Added to portage

2026-10-25

jsonpatch - 1.37
Ebuild name:

dev-python/jsonpatch-1.37

Description

Apply JSON-Patches like http

Added to portage

2026-10-25

jsonpointer - 3.5
Ebuild name:

dev-python/jsonpointer-3.5

Description

Identify specific nodes in a JSON document (according to draft 08)

Added to portage

2026-10-25

log4j-core - 2.26.0-r1
Ebuild name:

dev-java/log4j-core-2.26.0-r1

Description

The Apache Log4j Implementation

Added to portage

2026-10-25

lucene - 2.4.1-r6
Ebuild name:

dev-java/lucene-2.4.1-r6

Description

High-performance, full-featured text search engine written entirely in Jav

Added to portage

2026-10-25

multidict - 7.2.1
Ebuild name:

dev-python/multidict-7.2.1

Description

multidict implementation

Added to portage

2026-10-25

mysql-connector-c - 26.10.0
Ebuild name:

dev-db/mysql-connector-c-26.10.0

Description

C client library for MariaDB/MySQL

Added to portage

2026-10-25

mysql-connector-c - 8.0.46
Ebuild name:

dev-db/mysql-connector-c-8.0.46

Description

C client library for MariaDB/MySQL

Added to portage

2026-10-25

openssh - 0-r2
Ebuild name:

virtual/openssh-0-r2

Description

Virtual for net-misc/openssh and variants

Added to portage

2026-10-25

pam_p11 - 0.6.1
Ebuild name:

sys-auth/pam_p11-0.6.1

Description

PAM module for authenticating against PKCS11 tokens

Added to portage

2026-10-25

pcsc-lite - 2.5.3
Ebuild name:

sys-apps/pcsc-lite-2.5.3

Description

PC/SC Architecture smartcard middleware library

Added to portage

2026-10-25

pcsc-tools - 1.7.5
Ebuild name:

sys-apps/pcsc-tools-1.7.5

Description

PC/SC Architecture smartcard tools

Added to portage

2026-10-25

pkcs11-provider - 1.3.0
Ebuild name:

dev-libs/pkcs11-provider-1.3.0

Description

OpenSSL 3+ provider to access hardware or software tokens via PKCS11

Added to portage

2026-10-25

pkgcheck - 0.10.49
Ebuild name:

dev-util/pkgcheck-0.10.49

Description

pkgcore-based QA utility for ebuild repos

Added to portage

2026-10-25

pkgcore - 0.12.48
Ebuild name:

sys-apps/pkgcore-0.12.48

Description

a framework for package management

Added to portage

2026-10-25

pkgdev - 0.2.19
Ebuild name:

dev-util/pkgdev-0.2.19

Description

Collection of tools for Gentoo development

Added to portage

2026-10-25

publicsuffix-db - 20260907
Ebuild name:

net-misc/publicsuffix-db-20260907

Description

The Public Suffix List

Added to portage

2026-10-25

pycryptodome - 4.2.0
Ebuild name:

dev-python/pycryptodome-4.2.0

Description

A self-contained cryptographic library for Python

Added to portage

2026-10-25

qbittorrent - 5.3.0
Ebuild name:

net-p2p/qbittorrent-5.3.0

Description

BitTorrent client in C++ and Qt

Added to portage

2026-10-25

simdutf - 9.3.2
Ebuild name:

dev-cpp/simdutf-9.3.2

Description

Unicode validation and transcoding at billions of characters per second

Added to portage

2026-10-25

softhsm - 2.7.0
Ebuild name:

dev-libs/softhsm-2.7.0

Description

A software PKCS11 implementation

Added to portage

2026-10-25

starlette - 1.10.0
Ebuild name:

dev-python/starlette-1.10.0

Description

The little ASGI framework that shines

Added to portage

2026-10-25

sun-jai-bin - 1.1.3-r4
Ebuild name:

dev-java/sun-jai-bin-1.1.3-r4

Description

JAI is a class library for managing images

Added to portage

2026-10-25

sunshine - 2026.914.233613
Ebuild name:

net-misc/sunshine-2026.914.233613

Description

Self-hosted game stream host for Moonlight

Added to portage

2026-10-25

wcwidth - 0.9.4
Ebuild name:

dev-python/wcwidth-0.9.4

Description

Measures number of Terminal column cells of wide-character codes

Added to portage

2026-10-25

wtforms - 3.3.1
Ebuild name:

dev-python/wtforms-3.3.1

Description

Flexible forms validation and rendering library for python web development

Added to portage

2026-10-25

zoitechat - 2.19.1
Ebuild name:

net-irc/zoitechat-2.19.1

Description

GTK+ IRC client that's a fork of HexChat

Added to portage

2026-10-25

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