You are here: Foswiki>ATLAS Web>Initrd (25 May 2007, MatthiasLInden)Edit Attach

What is initrd


A few hints on initrd

The Script that is executed after Startup is located /usr/share/initrd-tools/lnuxrc Runlevel?

Files, executalbles and modules that should be present on the new System are located in /etc/mkinitrd/exe, /etc/mkinitrd/files, /etc/mkinitrd/modules

The initrd image is build and stored in the tftp/boot/ dir calling mkinitrd -o /srv/tftp/boot/initrd

File listings


Files are fetched via tftp from the server.

 # $Id: linuxrc,v 1.11 2004/04/26 12:04:46 herbert Exp $
 dir="etc dev var"
 modules="dm-mod usbhid forcedeth loop"
 export PATH=/sbin:/bin:/usr/bin
 mount -nt proc proc proc
 # load modules
 for i in $modules; do
 	modprobe $i

The folowing makes the initrd System read-writeable by creating ramdisks, copying the contents of the $dirs and remounting the ramdisks

 for i in $dir; do
 	# formatting the ram-disk
 	mkfs.ext3 -m0 /dev/ram$num
 	mount /dev/ram$num /mnt
 	cp -ar /$i/* /mnt/.
 	umount /mnt
 	mount /dev/ram$num /$i
 	let num=$num+1
  mkfs.ext3 /dev/ram$num
  mount /dev/ram$num /tmp
  dhclient                           <-- What is that line for?
 cd /tmp
Fdisk is used to create partitions according to the format for further information visit dfisk, where the actual listing is explained. A swap, /boot and LVM parition are created.
 tftp -c get cfg/format
 cat format | fdisk /dev/sda
 rm format
The lvm script is downloaded and executed. The Script is explained under lvm
 tftp -c get cfg/lvm
 chmod 0755 lvm
 rm lvm
The install script is executed, installing a minimal image, visit install-script
 tftp -c get cfg/install
 chmod 0755 install
 rm install
 # umount all mounted directories to avoid trouble
 for i in $dir; do
 	umount /$i
 root=$(cat proc/sys/kernel/real-root-dev)
 echo 256 > proc/sys/kernel/real-root-dev
 mount -nt tmpfs tmpfs bin || mount -nt ramfs ramfs bin
 echo $root > bin/root
Topic revision: r1 - 25 May 2007, MatthiasLInden
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback