mkinitrd

Langue: en

Version: 51709 (openSuse - 09/10/07)

Autres sections - même nom

Section: 8 (Commandes administrateur)

NAME

mkinitrd, mk_initrd - create initrd disk image

SYNOPSIS

mkinitrd [options] [root_dir]

DESCRIPTION

mkinitrd creates initial ramdisk images for booting Linux. The "/init" script in the compressed cpio archive loads all driver modules, creates all device nodes currently known by the kernel, initializes vital subsystems (e.g. networking when doing nfs), does a filesystem check on the root filesystem and finally passes control to /sbin/init. udev is used to create the device nodes in a tmpfs mounted /dev directory. This directory is moved over to the final root filesystem, essentially hiding the on-disk content below /dev on the root filesystem.

A few options can be specified via the kernel command line to modify some hardcoded values in the "/init" script. They are read from /proc/cmdline.

While in the old days the Linux kernel was responsible for mounting the rootfilesystem and running /sbin/init, all the work is now done by the "/init" script.

OPTIONS

-h
This Text.
-k "kernel list"
list of kernel images for which initrd files are created (relative to boot_dir), defaults to "vmlinux" on powerpc, "image" on s390 and "vmlinuz" for everything else.
-i "initrd list"
list of file names (relativ to boot_dir) for the initrd; positions have to match the "kernel list", defaults to "initrd"
-m "module list"
modules to include in initrd, defaults to INITRD_MODULES variable in /etc/sysconfig/kernel
-f "feature list"
features to be enabled for the initrd. In general mkinitrd configures the initrd for the root device it is started from. With this option additional feature can be enabled.
-b boot_dir
boot dir, defaults to "/boot", where the initrd is created.
-d root_device
root device, defaults to the device from which the root_dir is mounted; overwrites the rootdev enviroment variable if set
-s size
Add splash animation and bootscreen to initrd.
-D interface
Run dhcp on the specified interface.
-I interface
Configure the specified interface statically.
-a acpi_dsdt
Attach compiled ACPI DSDT (Differentiated System Description Table) to initrd. This replaces the DSDT of the BIOS. Defaults to the ACPI_DSDT variable in /etc/sysconfig/kernel.
-t tmp_dir
tmp dir, defaults to "/tmp".
-e
Use static binaries where possible. (currently unavailable)
-P
Include modules for all IDE devices on the PCI bus.
-V script
Vendor specific script to run in linuxrc.
-M map
System.map file to use.
-j device
External journal device to use for the root filesystem.
-l directory
Directory to use for mkinitrd files instead of /lib/mkinitrd
-A
Create a so called "monster initrd" which includes all available features and modules.
root_dir
the directory the root partition is mounted to defaults to "/"

KERNEL COMMAND-LINE PARAMETER

mkinitrd implements a set of additional kernel command-line parameters which are interpreted by the generated init script. In addition to the standard kernel parameters the following parameters are supported:
linuxrc=trace
Enabling command tracing of the init script
noresume
Do not check for a resume device
sysrq=yes
sysrq=1 Enable sysrq
resume=<device>
Resume from device <device>
journal=<device>
Use device <device> as external journal device. This is only valid for reiser and xfs filesystems.
mduuid=<UUID>
Mount md RAID with uuid <UUID as the root filesystem.
TargetAddress=<IP Address>
[iSCSI] IP Address of the iSCSI Target
InitiatorName=<iqn>
[iSCSI] Use <iqn> as the iSCIS initiatorname.
ip=<ipspec>
Use <ipspec> to configure the network interface. Format of the <ipspec> is <client>:<server>:<gateway>:<netmask>:<hostname>:<device>:<proto>. <client>, <server>, <gateway>, <netmask> are in the standard dotted-decimal IP notation. <proto> is currently ignored.
udev_timeout=<secs>
Set the timeout for root device detection to <secs> seconds. Default is 10.

FEATURES

Normally mkinitrd detects all required features automatically, based upon the current root, resume, dump and journal device. If additional features should be enabled, the -f option can be specified. Of course you can write your own features as well. Just take a look at /lib/mkinitrd.

Currently, the following features can be selected (if a feature is available depends on the installed packages):

block
Include support for block devices (SCSI and IDE)
busybox
Replace and add all tools known as safe with the busybox versions
dasd
Include support for dasd storage devices (s390)
dmraid
Include support for Software-Raid over device mapper (known as Fake-Raid)
dm
Include support for device mapper in general
evms
Add support for EVMS
firewire
Include firewire storage
iscsi
Include iSCSI support
kpartx
Include support for kpartx partitioning. Always use this if you have device mapper devices.
luks
Include encryption support using luks
lvm2
Include support for LVM2
md
Include support for Software RAID (md)
multipath
Include support for multipathing
netconsole
Include support for debugging using netconsole
network
Include networking support
nfs
Include support for nfs(-root)
resume.kernel
Include resume support using the kernel resume code
resume.userspace
Include resume support using the userspace program
usb
Include USB-support (keyboard and storage)
vendor
Include vendor script support
zfcp
Include support for zfcp storage devices (s390)

Using NFS as root filesystem

To configure an initrd for an NFS client, specify these options to add nfs and network driver support into the initrd:
mkinitrd -m "nfs e1000" -D eth0
This will add the required kernel modules and a dhcp client to the initrd, which will try to get an IP address via eth0. Boot the NFS client with these additional command line options to mount the server: nfsroot=1.2.3.4:/exported/directory
mkinitrd -m "nfs e1000" -I eth0
This will add the required kernel modules to the initrd, a static IP address must be specified on the kernel cmdline. Boot the NFS client with these additional command line options to mount the server: nfsroot=1.2.3.4:/exported/directory ip=1.2.3.42:1.2.3.4:1.2.3.1:255.255.255.0:clienthostname:eth0:none . See the ip= description above for details about the ip= option.
mkinitrd
Due to the new autodetection in mkinitrd it should suffice if the /-entry in /etc/fstab is an nfs target. The network device which will be used should have STARTMODE set to nfsroot

NOTE

mk_initrd is now a symbolic link to mkinitrd.

ENVIRONMENT VARIABLES

You can specify the root device via the environment variable rootdev (e.g. "rootdev=/dev/hda mk_initrd"). .SHRECOVERY What should you do if the initrd is broken and you can't get the system back up?
1. Boot into the system using the installation CD
2. Run mkinitrd

What should you do if the initrd is broken and you want to fix it using a chroot? I assume /mnt is your target root and /boot is mounted inside.

1. mount --bind /dev /mnt/dev
2. chroot /mnt
3. mount /proc
4. mount /sys
5. mkinitrd

ENVIRONMENT VARIABLES

You can specify the root device via the environment variable rootdev (e.g. "rootdev=/dev/hda mk_initrd"). .SHAUTHOR Steffen Winterfeldt <wfeldt@suse.de>, Susanne Oberhauser <froh@suse.de>, Andreas Gruenbacher <agruen@suse.de>, Hannes Reinecke <hare@suse.de>, Alexander Graf <agraf@suse.de>