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:

86529

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-04
forbiddenfruit - 0.1.4-r1
Ebuild name:

dev-python/forbiddenfruit-0.1.4-r1

Description

Patch built-in Python objects

Added to portage

2026-07-04

intellij-idea - 2026.1.4
Ebuild name:

dev-util/intellij-idea-2026.1.4

Description

A complete toolset for web, mobile and enterprise development

Added to portage

2026-07-04

libmemcached-awesome - 1.1.4-r1
Ebuild name:

dev-libs/libmemcached-awesome-1.1.4-r1

Description

a C/C++ memcached client library

Added to portage

2026-07-04

mod_wsgi - 6.0.5
Ebuild name:

www-apache/mod_wsgi-6.0.5

Description

An Apache2 module for running Python WSGI applications

Added to portage

2026-07-04

pylibmc - 1.6.3-r3
Ebuild name:

dev-python/pylibmc-1.6.3-r3

Description

Libmemcached wrapper written as a Python extension

Added to portage

2026-07-04

pyquery - 2.0.1-r1
Ebuild name:

dev-python/pyquery-2.0.1-r1

Description

A jQuery-like library for python

Added to portage

2026-07-04

pytest-expect - 1.1.0-r3
Ebuild name:

dev-python/pytest-expect-1.1.0-r3

Description

pytest plugin that stores test expectations by saving the set of

Added to portage

2026-07-04

virtualbox - 7.2.12
Ebuild name:

app-emulation/virtualbox-7.2.12

Description

Family of powerful x86 virtualization products for enterprise and h

Added to portage

2026-07-04

virtualbox-additions - 7.2.12
Ebuild name:

app-emulation/virtualbox-additions-7.2.12

Description

CD image containing guest additions for VirtualBox

Added to portage

2026-07-04

virtualbox-extpack-oracle - 7.2.12
Ebuild name:

app-emulation/virtualbox-extpack-oracle-7.2.12

Description

PUEL extensions for VirtualBox

Added to portage

2026-07-04

virtualbox-guest-additions - 7.2.12
Ebuild name:

app-emulation/virtualbox-guest-additions-7.2.12

Description

VirtualBox kernel modules and user-space tools for

Added to portage

2026-07-04

virtualbox-guest-modules - 7.2.12
Ebuild name:

app-emulation/virtualbox-guest-modules-7.2.12

Description

Kernel Modules for Virtualbox Guest Additions

Added to portage

2026-07-04

virtualbox-kvm - 7.2.12_pre20260201
Ebuild name:

app-emulation/virtualbox-kvm-7.2.12_pre20260201

Description

Family of powerful x86 virtualization products for

Added to portage

2026-07-04

virtualbox-modules - 7.2.12
Ebuild name:

app-emulation/virtualbox-modules-7.2.12

Description

Kernel Modules for Virtualbox

Added to portage

2026-07-04

zlib-ng - 1.0.0-r1
Ebuild name:

dev-python/zlib-ng-1.0.0-r1

Description

Drop-in replacement for zlib and gzip modules using zlib-ng

Added to portage

2026-07-04

zope-testing - 6.2
Ebuild name:

dev-python/zope-testing-6.2

Description

Zope testing helpers

Added to portage

2026-07-04

2026-07-03
awkward - 2.10.0
Ebuild name:

dev-python/awkward-2.10.0

Description

Manipulate JSON-like data with NumPy-like idioms

Added to portage

2026-07-03

awkward-cpp - 54
Ebuild name:

dev-python/awkward-cpp-54

Description

CPU kernels and compiled extensions for Awkward Array

Added to portage

2026-07-03

awscli - 1.45.40
Ebuild name:

app-admin/awscli-1.45.40

Description

Universal Command Line Environment for AWS

Added to portage

2026-07-03

bitwarden-desktop-bin - 2026.6.0
Ebuild name:

app-admin/bitwarden-desktop-bin-2026.6.0

Description

Bitwarden password manager desktop client

Added to portage

2026-07-03

boto3 - 1.43.40
Ebuild name:

dev-python/boto3-1.43.40

Description

The AWS SDK for Python

Added to portage

2026-07-03

botocore - 1.43.40
Ebuild name:

dev-python/botocore-1.43.40

Description

Low-level, data-driven core of boto 3

Added to portage

2026-07-03

candy - 6.1.8
Ebuild name:

net-vpn/candy-6.1.8

Description

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

Added to portage

2026-07-03

certbot - 5.6.0
Ebuild name:

app-crypt/certbot-5.6.0

Description

Let's Encrypt client to automate deployment of X.509 certificates

Added to portage

2026-07-03

clamav - 0.103.12-r5
Ebuild name:

app-antivirus/clamav-0.103.12-r5

Description

Clam Anti-Virus Scanner

Added to portage

2026-07-03

coverage - 7.15.0
Ebuild name:

dev-python/coverage-7.15.0

Description

Code coverage measurement for Python

Added to portage

2026-07-03

croniter - 6.2.3
Ebuild name:

dev-python/croniter-6.2.3

Description

Python module to provide iteration for datetime object

Added to portage

2026-07-03

derper - 1.100.0
Ebuild name:

net-vpn/derper-1.100.0

Description

DERP server for tailscale network

Added to portage

2026-07-03

dune - 3.23.1
Ebuild name:

dev-ml/dune-3.23.1

Description

A composable build system for OCaml

Added to portage

2026-07-03

faudio - 26.07
Ebuild name:

app-emulation/faudio-26.07

Description

Accuracy-focused XAudio reimplementation for open platforms

Added to portage

2026-07-03

filezilla - 3.70.6
Ebuild name:

net-ftp/filezilla-3.70.6

Description

FTP client with lots of useful features and an intuitive interface

Added to portage

2026-07-03

fitsio - 1.4.0
Ebuild name:

dev-python/fitsio-1.4.0

Description

Python library to read from and write to FITS files

Added to portage

2026-07-03

framework_tool - 0.6.5
Ebuild name:

app-laptop/framework_tool-0.6.5

Description

Tool to control Framework Computer systems

Added to portage

2026-07-03

fzssh - 1.3.0
Ebuild name:

net-libs/fzssh-1.3.0

Description

A SSH/SFTP library based on libfilezilla

Added to portage

2026-07-03

itsdangerous - 2.2.0-r1
Ebuild name:

dev-python/itsdangerous-2.2.0-r1

Description

Various helpers to pass trusted data to untrusted environments and

Added to portage

2026-07-03

libfilezilla - 0.56.1
Ebuild name:

dev-libs/libfilezilla-0.56.1

Description

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

Added to portage

2026-07-03

libmd - 1.2.0
Ebuild name:

app-crypt/libmd-1.2.0

Description

Message Digest functions from BSD systems

Added to portage

2026-07-03

libmodbus - 3.2.0
Ebuild name:

dev-libs/libmodbus-3.2.0

Description

Modbus library which supports RTU communication over a serial line or a TC

Added to portage

2026-07-03

libscrypt - 1.22-r3
Ebuild name:

app-crypt/libscrypt-1.22-r3

Description

Shared library to implement the scrypt algorithm

Added to portage

2026-07-03

libscrypt - 1.22-r3
Ebuild name:

app-crypt/libscrypt-1.22-r3

Description

Shared library to implement the scrypt algorithm

Added to portage

2026-07-03

libupnp - 2.0.2
Ebuild name:

net-libs/libupnp-2.0.2

Description

An Portable Open Source UPnP Development Kit

Added to portage

2026-07-03

lsp-treemacs - 0.5
Ebuild name:

app-emacs/lsp-treemacs-0.5

Description

Integration between lsp-mode and treemacs

Added to portage

2026-07-03

nattka - 0.4.3
Ebuild name:

app-portage/nattka-0.4.3

Description

A New Arch Tester Toolkit -- open-source stable-bot replacement

Added to portage

2026-07-03

nerdctl - 2.3.4
Ebuild name:

app-containers/nerdctl-2.3.4

Description

Docker-compatible CLI for containerd, with support for Compose

Added to portage

2026-07-03

netifrc - 0.7.13-r1
Ebuild name:

net-misc/netifrc-0.7.13-r1

Description

Gentoo Network Interface Management Scripts

Added to portage

2026-07-03

netifrc - 0.7.14-r1
Ebuild name:

net-misc/netifrc-0.7.14-r1

Description

Gentoo Network Interface Management Scripts

Added to portage

2026-07-03

openpgp-keys-acl - 20260702
Ebuild name:

sec-keys/openpgp-keys-acl-20260702

Description

OpenPGP keys used by sys-apps/acl

Added to portage

2026-07-03

openrc - 0.63.3
Ebuild name:

sys-apps/openrc-0.63.3

Description

OpenRC manages the services, startup and shutdown of a host

Added to portage

2026-07-03

pjproject - 2.17-r1
Ebuild name:

net-libs/pjproject-2.17-r1

Description

Open source SIP, Media, and NAT Traversal Library

Added to portage

2026-07-03

puppet - 8.10.0-r1
Ebuild name:

app-admin/puppet-8.10.0-r1

Description

A system automation and configuration management software

Added to portage

2026-07-03

pycargoebuild - 0.16.0
Ebuild name:

app-portage/pycargoebuild-0.16.0

Description

A generator for Rust/Cargo ebuilds written in Python

Added to portage

2026-07-03

pymdown-extensions - 11.0.1
Ebuild name:

dev-python/pymdown-extensions-11.0.1

Description

Extensions for Python Markdown

Added to portage

2026-07-03

python-ironicclient - 6.2.0
Ebuild name:

dev-python/python-ironicclient-6.2.0

Description

Python bindings for the Ironic API

Added to portage

2026-07-03

python-utils - 4.0.0
Ebuild name:

dev-python/python-utils-4.0.0

Description

Collection of small Python functions & classes

Added to portage

2026-07-03

qmmp - 2.3.3
Ebuild name:

media-sound/qmmp-2.3.3

Description

Qt-based audio player with winamp/xmms skins support

Added to portage

2026-07-03

qmmp-plugin-pack - 2.3.1
Ebuild name:

media-plugins/qmmp-plugin-pack-2.3.1

Description

Set of extra plugins for Qmmp

Added to portage

2026-07-03

qpdfview - 0.5_p20260701
Ebuild name:

app-text/qpdfview-0.5_p20260701

Description

Tabbed document viewer

Added to portage

2026-07-03

rar - 7.23
Ebuild name:

app-arch/rar-7.23

Description

RAR compressor/uncompressor

Added to portage

2026-07-03

slack - 4.50.143
Ebuild name:

net-im/slack-4.50.143

Description

Team collaboration tool

Added to portage

2026-07-03

smartdns - 48.2
Ebuild name:

net-dns/smartdns-48.2

Description

A local DNS server returns the fastest access results

Added to portage

2026-07-03

stevedore - 5.9.0
Ebuild name:

dev-python/stevedore-5.9.0

Description

Manage dynamic plugins for Python applications

Added to portage

2026-07-03

subrandr - 1.4.0
Ebuild name:

media-libs/subrandr-1.4.0

Description

Subtitle rendering library for rendering non-ASS subtitles

Added to portage

2026-07-03

ttyrec - 1.2.0.0
Ebuild name:

app-misc/ttyrec-1.2.0.0

Description

ttyrec provides tools to record and replay a terminal session

Added to portage

2026-07-03

typing-extensions - 4.16.0
Ebuild name:

dev-python/typing-extensions-4.16.0

Description

Backported and Experimental Type Hints for Python 3.7+

Added to portage

2026-07-03

unrar - 7.2.7
Ebuild name:

app-arch/unrar-7.2.7

Description

Uncompress rar files

Added to portage

2026-07-03

wcmatch - 10.2.1
Ebuild name:

dev-python/wcmatch-10.2.1

Description

Wildcard/glob file name matcher

Added to portage

2026-07-03

yq-go - 4.53.3
Ebuild name:

app-misc/yq-go-4.53.3

Description

yq is a lightweight and portable command-line YAML, JSON and XML processor

Added to portage

2026-07-03

zsh-completions - 0.36.0
Ebuild name:

app-shells/zsh-completions-0.36.0

Description

Additional completion definitions for Zsh

Added to portage

2026-07-03

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