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:

84658

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-04-27
blake3 - 1.8.5
Ebuild name:

dev-libs/blake3-1.8.5

Description

a fast cryptographic hash function

Added to portage

2026-04-27

fluidsynth - 2.5.4
Ebuild name:

media-sound/fluidsynth-2.5.4

Description

Software real-time synthesizer based on the Soundfont 2 specifications

Added to portage

2026-04-27

gpsd - 3.27.5
Ebuild name:

sci-geosciences/gpsd-3.27.5

Description

GPS daemon and library for USB/serial GPS devices and GPS/mapping clien

Added to portage

2026-04-27

nxml-libvirt-schemas - 12.0.0
Ebuild name:

app-emacs/nxml-libvirt-schemas-12.0.0

Description

Extension for nxml-mode with libvirt schemas

Added to portage

2026-04-27

openpgp-keys-garyemiller - 20230413
Ebuild name:

sec-keys/openpgp-keys-garyemiller-20230413

Description

OpenPGP key for Gary E. Miller

Added to portage

2026-04-27

selinux-accountsd - 2.20250213_p1
Ebuild name:

sec-policy/selinux-accountsd-2.20250213_p1

Description

SELinux policy for accountsd

Added to portage

2026-04-27

selinux-accountsd - 2.20250618_p1
Ebuild name:

sec-policy/selinux-accountsd-2.20250618_p1

Description

SELinux policy for accountsd

Added to portage

2026-04-27

selinux-acct - 2.20250213_p1
Ebuild name:

sec-policy/selinux-acct-2.20250213_p1

Description

SELinux policy for acct

Added to portage

2026-04-27

selinux-acct - 2.20250618_p1
Ebuild name:

sec-policy/selinux-acct-2.20250618_p1

Description

SELinux policy for acct

Added to portage

2026-04-27

selinux-afs - 2.20250213_p1
Ebuild name:

sec-policy/selinux-afs-2.20250213_p1

Description

SELinux policy for afs

Added to portage

2026-04-27

selinux-afs - 2.20250618_p1
Ebuild name:

sec-policy/selinux-afs-2.20250618_p1

Description

SELinux policy for afs

Added to portage

2026-04-27

selinux-aide - 2.20250213_p1
Ebuild name:

sec-policy/selinux-aide-2.20250213_p1

Description

SELinux policy for aide

Added to portage

2026-04-27

selinux-aide - 2.20250618_p1
Ebuild name:

sec-policy/selinux-aide-2.20250618_p1

Description

SELinux policy for aide

Added to portage

2026-04-27

selinux-alsa - 2.20250213_p1
Ebuild name:

sec-policy/selinux-alsa-2.20250213_p1

Description

SELinux policy for alsa

Added to portage

2026-04-27

selinux-alsa - 2.20250618_p1
Ebuild name:

sec-policy/selinux-alsa-2.20250618_p1

Description

SELinux policy for alsa

Added to portage

2026-04-27

selinux-amanda - 2.20250213_p1
Ebuild name:

sec-policy/selinux-amanda-2.20250213_p1

Description

SELinux policy for amanda

Added to portage

2026-04-27

selinux-amanda - 2.20250618_p1
Ebuild name:

sec-policy/selinux-amanda-2.20250618_p1

Description

SELinux policy for amanda

Added to portage

2026-04-27

selinux-amavis - 2.20250213_p1
Ebuild name:

sec-policy/selinux-amavis-2.20250213_p1

Description

SELinux policy for amavis

Added to portage

2026-04-27

selinux-amavis - 2.20250618_p1
Ebuild name:

sec-policy/selinux-amavis-2.20250618_p1

Description

SELinux policy for amavis

Added to portage

2026-04-27

selinux-android - 2.20250213_p1
Ebuild name:

sec-policy/selinux-android-2.20250213_p1

Description

SELinux policy for android

Added to portage

2026-04-27

selinux-android - 2.20250618_p1
Ebuild name:

sec-policy/selinux-android-2.20250618_p1

Description

SELinux policy for android

Added to portage

2026-04-27

selinux-apache - 2.20250213_p1
Ebuild name:

sec-policy/selinux-apache-2.20250213_p1

Description

SELinux policy for apache

Added to portage

2026-04-27

selinux-apache - 2.20250618_p1
Ebuild name:

sec-policy/selinux-apache-2.20250618_p1

Description

SELinux policy for apache

Added to portage

2026-04-27

selinux-apcupsd - 2.20250213_p1
Ebuild name:

sec-policy/selinux-apcupsd-2.20250213_p1

Description

SELinux policy for apcupsd

Added to portage

2026-04-27

selinux-apcupsd - 2.20250618_p1
Ebuild name:

sec-policy/selinux-apcupsd-2.20250618_p1

Description

SELinux policy for apcupsd

Added to portage

2026-04-27

selinux-apm - 2.20250213_p1
Ebuild name:

sec-policy/selinux-apm-2.20250213_p1

Description

SELinux policy for acpi

Added to portage

2026-04-27

selinux-apm - 2.20250618_p1
Ebuild name:

sec-policy/selinux-apm-2.20250618_p1

Description

SELinux policy for acpi

Added to portage

2026-04-27

selinux-arpwatch - 2.20250213_p1
Ebuild name:

sec-policy/selinux-arpwatch-2.20250213_p1

Description

SELinux policy for arpwatch

Added to portage

2026-04-27

selinux-arpwatch - 2.20250618_p1
Ebuild name:

sec-policy/selinux-arpwatch-2.20250618_p1

Description

SELinux policy for arpwatch

Added to portage

2026-04-27

selinux-asterisk - 2.20250213_p1
Ebuild name:

sec-policy/selinux-asterisk-2.20250213_p1

Description

SELinux policy for asterisk

Added to portage

2026-04-27

selinux-asterisk - 2.20250618_p1
Ebuild name:

sec-policy/selinux-asterisk-2.20250618_p1

Description

SELinux policy for asterisk

Added to portage

2026-04-27

selinux-at - 2.20250213_p1
Ebuild name:

sec-policy/selinux-at-2.20250213_p1

Description

SELinux policy for at

Added to portage

2026-04-27

selinux-at - 2.20250618_p1
Ebuild name:

sec-policy/selinux-at-2.20250618_p1

Description

SELinux policy for at

Added to portage

2026-04-27

selinux-automount - 2.20250213_p1
Ebuild name:

sec-policy/selinux-automount-2.20250213_p1

Description

SELinux policy for automount

Added to portage

2026-04-27

selinux-automount - 2.20250618_p1
Ebuild name:

sec-policy/selinux-automount-2.20250618_p1

Description

SELinux policy for automount

Added to portage

2026-04-27

selinux-avahi - 2.20250213_p1
Ebuild name:

sec-policy/selinux-avahi-2.20250213_p1

Description

SELinux policy for avahi

Added to portage

2026-04-27

selinux-avahi - 2.20250618_p1
Ebuild name:

sec-policy/selinux-avahi-2.20250618_p1

Description

SELinux policy for avahi

Added to portage

2026-04-27

selinux-awstats - 2.20250213_p1
Ebuild name:

sec-policy/selinux-awstats-2.20250213_p1

Description

SELinux policy for awstats

Added to portage

2026-04-27

selinux-awstats - 2.20250618_p1
Ebuild name:

sec-policy/selinux-awstats-2.20250618_p1

Description

SELinux policy for awstats

Added to portage

2026-04-27

selinux-backup - 2.20250213_p1
Ebuild name:

sec-policy/selinux-backup-2.20250213_p1

Description

SELinux policy for generic backup apps

Added to portage

2026-04-27

selinux-backup - 2.20250618_p1
Ebuild name:

sec-policy/selinux-backup-2.20250618_p1

Description

SELinux policy for generic backup apps

Added to portage

2026-04-27

selinux-bacula - 2.20250213_p1
Ebuild name:

sec-policy/selinux-bacula-2.20250213_p1

Description

SELinux policy for bacula

Added to portage

2026-04-27

selinux-bacula - 2.20250618_p1
Ebuild name:

sec-policy/selinux-bacula-2.20250618_p1

Description

SELinux policy for bacula

Added to portage

2026-04-27

selinux-base - 2.20250213_p1
Ebuild name:

sec-policy/selinux-base-2.20250213_p1

Description

Gentoo base policy for SELinux

Added to portage

2026-04-27

selinux-base - 2.20250618_p1
Ebuild name:

sec-policy/selinux-base-2.20250618_p1

Description

Gentoo base policy for SELinux

Added to portage

2026-04-27

selinux-base-policy - 2.20250213_p1
Ebuild name:

sec-policy/selinux-base-policy-2.20250213_p1

Description

SELinux policy for core modules

Added to portage

2026-04-27

selinux-base-policy - 2.20250618_p1
Ebuild name:

sec-policy/selinux-base-policy-2.20250618_p1

Description

SELinux policy for core modules

Added to portage

2026-04-27

selinux-bind - 2.20250213_p1
Ebuild name:

sec-policy/selinux-bind-2.20250213_p1

Description

SELinux policy for bind

Added to portage

2026-04-27

selinux-bind - 2.20250618_p1
Ebuild name:

sec-policy/selinux-bind-2.20250618_p1

Description

SELinux policy for bind

Added to portage

2026-04-27

selinux-bitcoin - 2.20250213_p1
Ebuild name:

sec-policy/selinux-bitcoin-2.20250213_p1

Description

SELinux policy for bitcoin

Added to portage

2026-04-27

2026-04-26
epix - 1.2.22
Ebuild name:

sci-visualization/epix-1.2.22

Description

2- and 3-D plotter for creating images (to be used in LaTeX)

Added to portage

2026-04-26

fail2ban - 1.1.0-r7
Ebuild name:

net-analyzer/fail2ban-1.1.0-r7

Description

Scans log files and bans IPs that show malicious signs

Added to portage

2026-04-26

font-util - 1.4.2
Ebuild name:

media-fonts/font-util-1.4.2

Description

X.Org font utilities

Added to portage

2026-04-26

gpxsee - 16.6
Ebuild name:

sci-geosciences/gpxsee-16.6

Description

Viewer and analyzer that supports gpx, tcx, kml, fit, igc and nmea file

Added to portage

2026-04-26

koleo-cli - 0.2.137.32
Ebuild name:

app-misc/koleo-cli-0.2.137.32

Description

A simple CLI for koleo.pl railway planner

Added to portage

2026-04-26

kooha - 2.3.1
Ebuild name:

media-video/kooha-2.3.1

Description

Elegant screen recorder for Wayland

Added to portage

2026-04-26

mutt - 2.3.2
Ebuild name:

mail-client/mutt-2.3.2

Description

A small but very powerful text-based mail client

Added to portage

2026-04-26

nagios - 4.5.12
Ebuild name:

net-analyzer/nagios-4.5.12

Description

The Nagios metapackage

Added to portage

2026-04-26

nagios-core - 4.5.12
Ebuild name:

net-analyzer/nagios-core-4.5.12

Description

Nagios core - monitoring daemon, web GUI, and documentation

Added to portage

2026-04-26

nh3 - 0.3.5
Ebuild name:

dev-python/nh3-0.3.5

Description

Ammonia HTML sanitizer Python binding

Added to portage

2026-04-26

nss - 3.112.5
Ebuild name:

dev-libs/nss-3.112.5

Description

Mozilla's Network Security Services library that implements PKI support

Added to portage

2026-04-26

nss - 3.123.1
Ebuild name:

dev-libs/nss-3.123.1

Description

Mozilla's Network Security Services library that implements PKI support

Added to portage

2026-04-26

phonenumbers - 9.0.29
Ebuild name:

dev-python/phonenumbers-9.0.29

Description

Python port of Google's libphonenumber

Added to portage

2026-04-26

postfix - 3.12_pre20260423
Ebuild name:

mail-mta/postfix-3.12_pre20260423

Description

A fast and secure drop-in replacement for sendmail

Added to portage

2026-04-26

raggre46 - 0.6.0
Ebuild name:

net-misc/raggre46-0.6.0

Description

Aggregate IPv4 & IPv6 network addresses

Added to portage

2026-04-26

safeeyes - 3.5.0
Ebuild name:

x11-misc/safeeyes-3.5.0

Description

Linux alternative to EyeLeo

Added to portage

2026-04-26

xbitmaps - 1.1.4
Ebuild name:

x11-misc/xbitmaps-1.1.4

Description

X.Org bitmaps data

Added to portage

2026-04-26

xrandr - 1.5.4
Ebuild name:

x11-apps/xrandr-1.5.4

Description

A primitive command line interface to RandR extension

Added to portage

2026-04-26

xxhash - 3.7.0
Ebuild name:

dev-python/xxhash-3.7.0

Description

Python binding for the xxHash library

Added to portage

2026-04-26

yara-python - 4.5.5
Ebuild name:

dev-python/yara-python-4.5.5

Description

Python interface for a malware identification and classification tool

Added to portage

2026-04-26

zope-interface - 8.4
Ebuild name:

dev-python/zope-interface-8.4

Description

Interfaces for Python

Added to portage

2026-04-26

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