|
Packit |
7cfc04 |
.\" This man-page is Copyright (C) 1997 John S. Kallal
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\" %%%LICENSE_START(VERBATIM)
|
|
Packit |
7cfc04 |
.\" Permission is granted to make and distribute verbatim copies of this
|
|
Packit |
7cfc04 |
.\" manual provided the copyright notice and this permission notice are
|
|
Packit |
7cfc04 |
.\" preserved on all copies.
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\" Permission is granted to copy and distribute modified versions of this
|
|
Packit |
7cfc04 |
.\" manual under the conditions for verbatim copying, provided that the
|
|
Packit |
7cfc04 |
.\" entire resulting derived work is distributed under the terms of a
|
|
Packit |
7cfc04 |
.\" permission notice identical to this one.
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\" Since the Linux kernel and libraries are constantly changing, this
|
|
Packit |
7cfc04 |
.\" manual page may be incorrect or out-of-date. The author(s) assume no
|
|
Packit |
7cfc04 |
.\" responsibility for errors or omissions, or for damages resulting from
|
|
Packit |
7cfc04 |
.\" the use of the information contained herein. The author(s) may not
|
|
Packit |
7cfc04 |
.\" have taken the same level of care in the production of this manual,
|
|
Packit |
7cfc04 |
.\" which is licensed free of charge, as they might when working
|
|
Packit |
7cfc04 |
.\" professionally.
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\" Formatted or processed versions of this manual, if unaccompanied by
|
|
Packit |
7cfc04 |
.\" the source, must acknowledge the copyright and author(s) of this work.
|
|
Packit |
7cfc04 |
.\" %%%LICENSE_END
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\" If the you wish to distribute versions of this work under other
|
|
Packit |
7cfc04 |
.\" conditions than the above, please contact the author(s) at the following
|
|
Packit |
7cfc04 |
.\" for permission:
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\" John S. Kallal -
|
|
Packit |
7cfc04 |
.\" email: <kallal@voicenet.com>
|
|
Packit |
7cfc04 |
.\" mail: 518 Kerfoot Farm RD, Wilmington, DE 19803-2444, USA
|
|
Packit |
7cfc04 |
.\" phone: (302)654-5478
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\" $Id: initrd.4,v 0.9 1997/11/07 05:05:32 kallal Exp kallal $
|
|
Packit |
7cfc04 |
.TH INITRD 4 2017-09-15 "Linux" "Linux Programmer's Manual"
|
|
Packit |
7cfc04 |
.SH NAME
|
|
Packit |
7cfc04 |
initrd \- boot loader initialized RAM disk
|
|
Packit |
7cfc04 |
.SH CONFIGURATION
|
|
Packit |
7cfc04 |
.I /dev/initrd
|
|
Packit |
7cfc04 |
is a read-only block device assigned
|
|
Packit |
7cfc04 |
major number 1 and minor number 250.
|
|
Packit |
7cfc04 |
Typically
|
|
Packit |
7cfc04 |
.I /dev/initrd
|
|
Packit |
7cfc04 |
is owned by
|
|
Packit |
7cfc04 |
.I root.disk
|
|
Packit |
7cfc04 |
with mode 0400 (read access by root only).
|
|
Packit |
7cfc04 |
If the Linux system does not have
|
|
Packit |
7cfc04 |
.I /dev/initrd
|
|
Packit |
7cfc04 |
already created, it can be created with the following commands:
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
.in +4n
|
|
Packit |
7cfc04 |
.EX
|
|
Packit |
7cfc04 |
mknod \-m 400 /dev/initrd b 1 250
|
|
Packit |
7cfc04 |
chown root:disk /dev/initrd
|
|
Packit |
7cfc04 |
.EE
|
|
Packit |
7cfc04 |
.in
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
Also, support for both "RAM disk" and "Initial RAM disk"
|
|
Packit |
7cfc04 |
(e.g.,
|
|
Packit |
7cfc04 |
.BR CONFIG_BLK_DEV_RAM=y
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.BR CONFIG_BLK_DEV_INITRD=y )
|
|
Packit |
7cfc04 |
must be compiled directly into the Linux kernel to use
|
|
Packit |
7cfc04 |
.IR /dev/initrd .
|
|
Packit |
7cfc04 |
When using
|
|
Packit |
7cfc04 |
.IR /dev/initrd ,
|
|
Packit |
7cfc04 |
the RAM disk driver cannot be loaded as a module.
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.SH DESCRIPTION
|
|
Packit |
7cfc04 |
The special file
|
|
Packit |
7cfc04 |
.I /dev/initrd
|
|
Packit |
7cfc04 |
is a read-only block device.
|
|
Packit |
7cfc04 |
This device is a RAM disk that is initialized (e.g., loaded)
|
|
Packit |
7cfc04 |
by the boot loader before the kernel is started.
|
|
Packit |
7cfc04 |
The kernel then can use
|
|
Packit |
7cfc04 |
.IR /dev/initrd "'s "
|
|
Packit |
7cfc04 |
contents for a two-phase system boot-up.
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
In the first boot-up phase, the kernel starts up
|
|
Packit |
7cfc04 |
and mounts an initial root filesystem from the contents of
|
|
Packit |
7cfc04 |
.I /dev/initrd
|
|
Packit |
7cfc04 |
(e.g., RAM disk initialized by the boot loader).
|
|
Packit |
7cfc04 |
In the second phase, additional drivers or other modules
|
|
Packit |
7cfc04 |
are loaded from the initial root device's contents.
|
|
Packit |
7cfc04 |
After loading the additional modules, a new root filesystem
|
|
Packit |
7cfc04 |
(i.e., the normal root filesystem) is mounted from a
|
|
Packit |
7cfc04 |
different device.
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.SS Boot-up operation
|
|
Packit |
7cfc04 |
When booting up with
|
|
Packit |
7cfc04 |
.BR initrd ,
|
|
Packit |
7cfc04 |
the system boots as follows:
|
|
Packit |
7cfc04 |
.IP 1. 3
|
|
Packit |
7cfc04 |
The boot loader loads the kernel program and
|
|
Packit |
7cfc04 |
.IR /dev/initrd 's
|
|
Packit |
7cfc04 |
contents into memory.
|
|
Packit |
7cfc04 |
.IP 2.
|
|
Packit |
7cfc04 |
On kernel startup,
|
|
Packit |
7cfc04 |
the kernel uncompresses and copies the contents of the device
|
|
Packit |
7cfc04 |
.I /dev/initrd
|
|
Packit |
7cfc04 |
onto device
|
|
Packit |
7cfc04 |
.I /dev/ram0
|
|
Packit |
7cfc04 |
and then frees the memory used by
|
|
Packit |
7cfc04 |
.IR /dev/initrd .
|
|
Packit |
7cfc04 |
.IP 3.
|
|
Packit |
7cfc04 |
The kernel then read-write mounts the device
|
|
Packit |
7cfc04 |
.I /dev/ram0
|
|
Packit |
7cfc04 |
as the initial root filesystem.
|
|
Packit |
7cfc04 |
.IP 4.
|
|
Packit |
7cfc04 |
If the indicated normal root filesystem is also the initial
|
|
Packit |
7cfc04 |
root filesystem (e.g.,
|
|
Packit |
7cfc04 |
.IR /dev/ram0 )
|
|
Packit |
7cfc04 |
then the kernel skips to the last step for the usual boot sequence.
|
|
Packit |
7cfc04 |
.IP 5.
|
|
Packit |
7cfc04 |
If the executable file
|
|
Packit |
7cfc04 |
.IR /linuxrc
|
|
Packit |
7cfc04 |
is present in the initial root filesystem,
|
|
Packit |
7cfc04 |
.I /linuxrc
|
|
Packit |
7cfc04 |
is executed with UID 0.
|
|
Packit |
7cfc04 |
(The file
|
|
Packit |
7cfc04 |
.I /linuxrc
|
|
Packit |
7cfc04 |
must have executable permission.
|
|
Packit |
7cfc04 |
The file
|
|
Packit |
7cfc04 |
.I /linuxrc
|
|
Packit |
7cfc04 |
can be any valid executable, including a shell script.)
|
|
Packit |
7cfc04 |
.IP 6.
|
|
Packit |
7cfc04 |
If
|
|
Packit |
7cfc04 |
.I /linuxrc
|
|
Packit |
7cfc04 |
is not executed or when
|
|
Packit |
7cfc04 |
.I /linuxrc
|
|
Packit |
7cfc04 |
terminates, the normal root filesystem is mounted.
|
|
Packit |
7cfc04 |
(If
|
|
Packit |
7cfc04 |
.I /linuxrc
|
|
Packit |
7cfc04 |
exits with any filesystems mounted on the initial root
|
|
Packit |
7cfc04 |
filesystem, then the behavior of the kernel is
|
|
Packit |
7cfc04 |
.BR UNSPECIFIED .
|
|
Packit |
7cfc04 |
See the NOTES section for the current kernel behavior.)
|
|
Packit |
7cfc04 |
.IP 7.
|
|
Packit |
7cfc04 |
If the normal root filesystem has a directory
|
|
Packit |
7cfc04 |
.IR /initrd ,
|
|
Packit |
7cfc04 |
the device
|
|
Packit |
7cfc04 |
.I /dev/ram0
|
|
Packit |
7cfc04 |
is moved from
|
|
Packit |
7cfc04 |
.IR /
|
|
Packit |
7cfc04 |
to
|
|
Packit |
7cfc04 |
.IR /initrd .
|
|
Packit |
7cfc04 |
Otherwise, if the directory
|
|
Packit |
7cfc04 |
.IR /initrd
|
|
Packit |
7cfc04 |
does not exist, the device
|
|
Packit |
7cfc04 |
.I /dev/ram0
|
|
Packit |
7cfc04 |
is unmounted.
|
|
Packit |
7cfc04 |
(When moved from
|
|
Packit |
7cfc04 |
.IR /
|
|
Packit |
7cfc04 |
to
|
|
Packit |
7cfc04 |
.IR /initrd ,
|
|
Packit |
7cfc04 |
.I /dev/ram0
|
|
Packit |
7cfc04 |
is not unmounted and therefore processes can remain running from
|
|
Packit |
7cfc04 |
.IR /dev/ram0 .
|
|
Packit |
7cfc04 |
If directory
|
|
Packit |
7cfc04 |
.I /initrd
|
|
Packit |
7cfc04 |
does not exist on the normal root filesystem
|
|
Packit |
7cfc04 |
and any processes remain running from
|
|
Packit |
7cfc04 |
.IR /dev/ram0
|
|
Packit |
7cfc04 |
when
|
|
Packit |
7cfc04 |
.I /linuxrc
|
|
Packit |
7cfc04 |
exits, the behavior of the kernel is
|
|
Packit |
7cfc04 |
.BR UNSPECIFIED .
|
|
Packit |
7cfc04 |
See the NOTES section for the current kernel behavior.)
|
|
Packit |
7cfc04 |
.IP 8.
|
|
Packit |
7cfc04 |
The usual boot sequence (e.g., invocation of
|
|
Packit |
7cfc04 |
.IR /sbin/init )
|
|
Packit |
7cfc04 |
is performed on the normal root filesystem.
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.SS Options
|
|
Packit |
7cfc04 |
The following boot loader options, when used with
|
|
Packit |
7cfc04 |
.BR initrd ,
|
|
Packit |
7cfc04 |
affect the kernel's boot-up operation:
|
|
Packit |
7cfc04 |
.TP
|
|
Packit |
7cfc04 |
.BI initrd= "filename"
|
|
Packit |
7cfc04 |
Specifies the file to load as the contents of
|
|
Packit |
7cfc04 |
.IR /dev/initrd .
|
|
Packit |
7cfc04 |
For
|
|
Packit |
7cfc04 |
.B LOADLIN
|
|
Packit |
7cfc04 |
this is a command-line option.
|
|
Packit |
7cfc04 |
For
|
|
Packit |
7cfc04 |
.B LILO
|
|
Packit |
7cfc04 |
you have to use this command in the
|
|
Packit |
7cfc04 |
.B LILO
|
|
Packit |
7cfc04 |
configuration file
|
|
Packit |
7cfc04 |
.IR /etc/lilo.config .
|
|
Packit |
7cfc04 |
The filename specified with this
|
|
Packit |
7cfc04 |
option will typically be a gzipped filesystem image.
|
|
Packit |
7cfc04 |
.TP
|
|
Packit |
7cfc04 |
.I noinitrd
|
|
Packit |
7cfc04 |
This boot option disables the two-phase boot-up operation.
|
|
Packit |
7cfc04 |
The kernel performs the usual boot sequence as if
|
|
Packit |
7cfc04 |
.I /dev/initrd
|
|
Packit |
7cfc04 |
was not initialized.
|
|
Packit |
7cfc04 |
With this option, any contents of
|
|
Packit |
7cfc04 |
.I /dev/initrd
|
|
Packit |
7cfc04 |
loaded into memory by the boot loader contents are preserved.
|
|
Packit |
7cfc04 |
This option permits the contents of
|
|
Packit |
7cfc04 |
.I /dev/initrd
|
|
Packit |
7cfc04 |
to be any data and need not be limited to a filesystem image.
|
|
Packit |
7cfc04 |
However, device
|
|
Packit |
7cfc04 |
.I /dev/initrd
|
|
Packit |
7cfc04 |
is read-only and can be read only one time after system startup.
|
|
Packit |
7cfc04 |
.TP
|
|
Packit |
7cfc04 |
.BI root= "device-name"
|
|
Packit |
7cfc04 |
Specifies the device to be used as the normal root filesystem.
|
|
Packit |
7cfc04 |
For
|
|
Packit |
7cfc04 |
.B LOADLIN
|
|
Packit |
7cfc04 |
this is a command-line option.
|
|
Packit |
7cfc04 |
For
|
|
Packit |
7cfc04 |
.B LILO
|
|
Packit |
7cfc04 |
this is a boot time option or
|
|
Packit |
7cfc04 |
can be used as an option line in the
|
|
Packit |
7cfc04 |
.B LILO
|
|
Packit |
7cfc04 |
configuration file
|
|
Packit |
7cfc04 |
.IR /etc/lilo.config .
|
|
Packit |
7cfc04 |
The device specified by the this option must be a mountable
|
|
Packit |
7cfc04 |
device having a suitable root filesystem.
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.SS Changing the normal root filesystem
|
|
Packit |
7cfc04 |
By default,
|
|
Packit |
7cfc04 |
the kernel's settings
|
|
Packit |
7cfc04 |
(e.g., set in the kernel file with
|
|
Packit |
7cfc04 |
.BR rdev (8)
|
|
Packit |
7cfc04 |
or compiled into the kernel file),
|
|
Packit |
7cfc04 |
or the boot loader option setting
|
|
Packit |
7cfc04 |
is used for the normal root filesystems.
|
|
Packit |
7cfc04 |
For an NFS-mounted normal root filesystem, one has to use the
|
|
Packit |
7cfc04 |
.B nfs_root_name
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.B nfs_root_addrs
|
|
Packit |
7cfc04 |
boot options to give the NFS settings.
|
|
Packit |
7cfc04 |
For more information on NFS-mounted root see the kernel documentation file
|
|
Packit |
7cfc04 |
.I Documentation/filesystems/nfs/nfsroot.txt
|
|
Packit |
7cfc04 |
.\" commit dc7a08166f3a5f23e79e839a8a88849bd3397c32
|
|
Packit |
7cfc04 |
(or
|
|
Packit |
7cfc04 |
.I Documentation/filesystems/nfsroot.txt
|
|
Packit |
7cfc04 |
before Linux 2.6.33).
|
|
Packit |
7cfc04 |
For more information on setting the root filesystem see also the
|
|
Packit |
7cfc04 |
.BR LILO
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.BR LOADLIN
|
|
Packit |
7cfc04 |
documentation.
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
It is also possible for the
|
|
Packit |
7cfc04 |
.I /linuxrc
|
|
Packit |
7cfc04 |
executable to change the normal root device.
|
|
Packit |
7cfc04 |
For
|
|
Packit |
7cfc04 |
.I /linuxrc
|
|
Packit |
7cfc04 |
to change the normal root device,
|
|
Packit |
7cfc04 |
.IR /proc
|
|
Packit |
7cfc04 |
must be mounted.
|
|
Packit |
7cfc04 |
After mounting
|
|
Packit |
7cfc04 |
.IR /proc ,
|
|
Packit |
7cfc04 |
.I /linuxrc
|
|
Packit |
7cfc04 |
changes the normal root device by writing into the proc files
|
|
Packit |
7cfc04 |
.IR /proc/sys/kernel/real-root-dev ,
|
|
Packit |
7cfc04 |
.IR /proc/sys/kernel/nfs-root-name ,
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.IR /proc/sys/kernel/nfs-root-addrs .
|
|
Packit |
7cfc04 |
For a physical root device, the root device is changed by having
|
|
Packit |
7cfc04 |
.I /linuxrc
|
|
Packit |
7cfc04 |
write the new root filesystem device number into
|
|
Packit |
7cfc04 |
.IR /proc/sys/kernel/real-root-dev .
|
|
Packit |
7cfc04 |
For an NFS root filesystem, the root device is changed by having
|
|
Packit |
7cfc04 |
.I /linuxrc
|
|
Packit |
7cfc04 |
write the NFS setting into files
|
|
Packit |
7cfc04 |
.IR /proc/sys/kernel/nfs-root-name
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.I /proc/sys/kernel/nfs-root-addrs
|
|
Packit |
7cfc04 |
and then writing 0xff (e.g., the pseudo-NFS-device number) into file
|
|
Packit |
7cfc04 |
.IR /proc/sys/kernel/real-root-dev .
|
|
Packit |
7cfc04 |
For example, the following shell command line would change
|
|
Packit |
7cfc04 |
the normal root device to
|
|
Packit |
7cfc04 |
.IR /dev/hdb1 :
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
.in +4n
|
|
Packit |
7cfc04 |
.EX
|
|
Packit |
7cfc04 |
echo 0x365 >/proc/sys/kernel/real-root-dev
|
|
Packit |
7cfc04 |
.EE
|
|
Packit |
7cfc04 |
.in
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
For an NFS example, the following shell command lines would change the
|
|
Packit |
7cfc04 |
normal root device to the NFS directory
|
|
Packit |
7cfc04 |
.I /var/nfsroot
|
|
Packit |
7cfc04 |
on a local networked NFS server with IP number 193.8.232.7 for a system with
|
|
Packit |
7cfc04 |
IP number 193.8.232.2 and named "idefix":
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
.in +4n
|
|
Packit |
7cfc04 |
.EX
|
|
Packit |
7cfc04 |
echo /var/nfsroot >/proc/sys/kernel/nfs-root-name
|
|
Packit |
7cfc04 |
echo 193.8.232.2:193.8.232.7::255.255.255.0:idefix \\
|
|
Packit |
7cfc04 |
>/proc/sys/kernel/nfs-root-addrs
|
|
Packit |
7cfc04 |
echo 255 >/proc/sys/kernel/real-root-dev
|
|
Packit |
7cfc04 |
.EE
|
|
Packit |
7cfc04 |
.in
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
.BR Note :
|
|
Packit |
7cfc04 |
The use of
|
|
Packit |
7cfc04 |
.I /proc/sys/kernel/real-root-dev
|
|
Packit |
7cfc04 |
to change the root filesystem is obsolete.
|
|
Packit |
7cfc04 |
See the Linux kernel source file
|
|
Packit |
7cfc04 |
.I Documentation/admin\-guide/initrd.rst
|
|
Packit |
7cfc04 |
.\" commit 9d85025b0418163fae079c9ba8f8445212de8568
|
|
Packit |
7cfc04 |
(or
|
|
Packit |
7cfc04 |
.I Documentation/initrd.txt
|
|
Packit |
7cfc04 |
before Linux 4.10)
|
|
Packit |
7cfc04 |
as well as
|
|
Packit |
7cfc04 |
.BR pivot_root (2)
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.BR pivot_root (8)
|
|
Packit |
7cfc04 |
for information on the modern method of changing the root filesystem.
|
|
Packit |
7cfc04 |
.\" FIXME . Should this manual page describe the pivot_root mechanism?
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.SS Usage
|
|
Packit |
7cfc04 |
The main motivation for implementing
|
|
Packit |
7cfc04 |
.B initrd
|
|
Packit |
7cfc04 |
was to allow for modular kernel configuration at system installation.
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
A possible system installation scenario is as follows:
|
|
Packit |
7cfc04 |
.IP 1. 3
|
|
Packit |
7cfc04 |
The loader program boots from floppy or other media with a minimal kernel
|
|
Packit |
7cfc04 |
(e.g., support for
|
|
Packit |
7cfc04 |
.IR /dev/ram ,
|
|
Packit |
7cfc04 |
.IR /dev/initrd ,
|
|
Packit |
7cfc04 |
and the ext2 filesystem) and loads
|
|
Packit |
7cfc04 |
.IR /dev/initrd
|
|
Packit |
7cfc04 |
with a gzipped version of the initial filesystem.
|
|
Packit |
7cfc04 |
.IP 2.
|
|
Packit |
7cfc04 |
The executable
|
|
Packit |
7cfc04 |
.I /linuxrc
|
|
Packit |
7cfc04 |
determines what is needed to (1) mount the normal root filesystem
|
|
Packit |
7cfc04 |
(i.e., device type, device drivers, filesystem) and (2) the
|
|
Packit |
7cfc04 |
distribution media (e.g., CD-ROM, network, tape, ...).
|
|
Packit |
7cfc04 |
This can be done by asking the user, by auto-probing,
|
|
Packit |
7cfc04 |
or by using a hybrid approach.
|
|
Packit |
7cfc04 |
.IP 3.
|
|
Packit |
7cfc04 |
The executable
|
|
Packit |
7cfc04 |
.I /linuxrc
|
|
Packit |
7cfc04 |
loads the necessary modules from the initial root filesystem.
|
|
Packit |
7cfc04 |
.IP 4.
|
|
Packit |
7cfc04 |
The executable
|
|
Packit |
7cfc04 |
.I /linuxrc
|
|
Packit |
7cfc04 |
creates and populates the root filesystem.
|
|
Packit |
7cfc04 |
(At this stage the normal root filesystem does not have to be a
|
|
Packit |
7cfc04 |
completed system yet.)
|
|
Packit |
7cfc04 |
.IP 5.
|
|
Packit |
7cfc04 |
The executable
|
|
Packit |
7cfc04 |
.IR /linuxrc
|
|
Packit |
7cfc04 |
sets
|
|
Packit |
7cfc04 |
.IR /proc/sys/kernel/real-root-dev ,
|
|
Packit |
7cfc04 |
unmount
|
|
Packit |
7cfc04 |
.IR /proc ,
|
|
Packit |
7cfc04 |
the normal root filesystem and any other filesystems
|
|
Packit |
7cfc04 |
it has mounted, and then terminates.
|
|
Packit |
7cfc04 |
.IP 6.
|
|
Packit |
7cfc04 |
The kernel then mounts the normal root filesystem.
|
|
Packit |
7cfc04 |
.IP 7.
|
|
Packit |
7cfc04 |
Now that the filesystem is accessible and intact,
|
|
Packit |
7cfc04 |
the boot loader can be installed.
|
|
Packit |
7cfc04 |
.IP 8.
|
|
Packit |
7cfc04 |
The boot loader is configured to load into
|
|
Packit |
7cfc04 |
.I /dev/initrd
|
|
Packit |
7cfc04 |
a filesystem with the set of modules that was used to bring up the system.
|
|
Packit |
7cfc04 |
(e.g., Device
|
|
Packit |
7cfc04 |
.I /dev/ram0
|
|
Packit |
7cfc04 |
can be modified, then unmounted, and finally, the image is written from
|
|
Packit |
7cfc04 |
.I /dev/ram0
|
|
Packit |
7cfc04 |
to a file.)
|
|
Packit |
7cfc04 |
.IP 9.
|
|
Packit |
7cfc04 |
The system is now bootable and additional installation tasks can be
|
|
Packit |
7cfc04 |
performed.
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
The key role of
|
|
Packit |
7cfc04 |
.I /dev/initrd
|
|
Packit |
7cfc04 |
in the above is to reuse the configuration data during normal system operation
|
|
Packit |
7cfc04 |
without requiring initial kernel selection, a large generic kernel or,
|
|
Packit |
7cfc04 |
recompiling the kernel.
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
A second scenario is for installations where Linux runs on systems with
|
|
Packit |
7cfc04 |
different hardware configurations in a single administrative network.
|
|
Packit |
7cfc04 |
In such cases, it may be desirable to use only a small set of kernels
|
|
Packit |
7cfc04 |
(ideally only one) and to keep the system-specific part of configuration
|
|
Packit |
7cfc04 |
information as small as possible.
|
|
Packit |
7cfc04 |
In this case, create a common file
|
|
Packit |
7cfc04 |
with all needed modules.
|
|
Packit |
7cfc04 |
Then, only the
|
|
Packit |
7cfc04 |
.I /linuxrc
|
|
Packit |
7cfc04 |
file or a file executed by
|
|
Packit |
7cfc04 |
.I /linuxrc
|
|
Packit |
7cfc04 |
would be different.
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
A third scenario is more convenient recovery disks.
|
|
Packit |
7cfc04 |
Because information like the location of the root filesystem
|
|
Packit |
7cfc04 |
partition is not needed at boot time, the system loaded from
|
|
Packit |
7cfc04 |
.I /dev/initrd
|
|
Packit |
7cfc04 |
can use a dialog and/or auto-detection followed by a
|
|
Packit |
7cfc04 |
possible sanity check.
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
Last but not least, Linux distributions on CD-ROM may use
|
|
Packit |
7cfc04 |
.B initrd
|
|
Packit |
7cfc04 |
for easy installation from the CD-ROM.
|
|
Packit |
7cfc04 |
The distribution can use
|
|
Packit |
7cfc04 |
.B LOADLIN
|
|
Packit |
7cfc04 |
to directly load
|
|
Packit |
7cfc04 |
.I /dev/initrd
|
|
Packit |
7cfc04 |
from CD-ROM without the need of any floppies.
|
|
Packit |
7cfc04 |
The distribution could also use a
|
|
Packit |
7cfc04 |
.B LILO
|
|
Packit |
7cfc04 |
boot floppy and then bootstrap a bigger RAM disk via
|
|
Packit |
7cfc04 |
.IR /dev/initrd
|
|
Packit |
7cfc04 |
from the CD-ROM.
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.SH FILES
|
|
Packit |
7cfc04 |
.I /dev/initrd
|
|
Packit |
7cfc04 |
.br
|
|
Packit |
7cfc04 |
.I /dev/ram0
|
|
Packit |
7cfc04 |
.br
|
|
Packit |
7cfc04 |
.I /linuxrc
|
|
Packit |
7cfc04 |
.br
|
|
Packit |
7cfc04 |
.I /initrd
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.SH NOTES
|
|
Packit |
7cfc04 |
.IP 1. 3
|
|
Packit |
7cfc04 |
With the current kernel, any filesystems that remain mounted when
|
|
Packit |
7cfc04 |
.I /dev/ram0
|
|
Packit |
7cfc04 |
is moved from
|
|
Packit |
7cfc04 |
.I /
|
|
Packit |
7cfc04 |
to
|
|
Packit |
7cfc04 |
.I /initrd
|
|
Packit |
7cfc04 |
continue to be accessible.
|
|
Packit |
7cfc04 |
However, the
|
|
Packit |
7cfc04 |
.I /proc/mounts
|
|
Packit |
7cfc04 |
entries are not updated.
|
|
Packit |
7cfc04 |
.IP 2.
|
|
Packit |
7cfc04 |
With the current kernel, if directory
|
|
Packit |
7cfc04 |
.I /initrd
|
|
Packit |
7cfc04 |
does not exist, then
|
|
Packit |
7cfc04 |
.I /dev/ram0
|
|
Packit |
7cfc04 |
will
|
|
Packit |
7cfc04 |
.B not
|
|
Packit |
7cfc04 |
be fully unmounted if
|
|
Packit |
7cfc04 |
.I /dev/ram0
|
|
Packit |
7cfc04 |
is used by any process or has any filesystem mounted on it.
|
|
Packit |
7cfc04 |
If
|
|
Packit |
7cfc04 |
.IR /dev/ram0
|
|
Packit |
7cfc04 |
is
|
|
Packit |
7cfc04 |
.B not
|
|
Packit |
7cfc04 |
fully unmounted, then
|
|
Packit |
7cfc04 |
.I /dev/ram0
|
|
Packit |
7cfc04 |
will remain in memory.
|
|
Packit |
7cfc04 |
.IP 3.
|
|
Packit |
7cfc04 |
Users of
|
|
Packit |
7cfc04 |
.I /dev/initrd
|
|
Packit |
7cfc04 |
should not depend on the behavior give in the above notes.
|
|
Packit |
7cfc04 |
The behavior may change in future versions of the Linux kernel.
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\" .SH AUTHORS
|
|
Packit |
7cfc04 |
.\" The kernel code for device
|
|
Packit |
7cfc04 |
.\" .BR initrd
|
|
Packit |
7cfc04 |
.\" was written by Werner Almesberger <almesber@lrc.epfl.ch> and
|
|
Packit |
7cfc04 |
.\" Hans Lermen <lermen@elserv.ffm.fgan.de>.
|
|
Packit |
7cfc04 |
.\" The code for
|
|
Packit |
7cfc04 |
.\" .BR initrd
|
|
Packit |
7cfc04 |
.\" was added to the baseline Linux kernel in development version 1.3.73.
|
|
Packit |
7cfc04 |
.SH SEE ALSO
|
|
Packit |
7cfc04 |
.BR chown (1),
|
|
Packit |
7cfc04 |
.BR mknod (1),
|
|
Packit |
7cfc04 |
.BR ram (4),
|
|
Packit |
7cfc04 |
.BR freeramdisk (8),
|
|
Packit |
7cfc04 |
.BR rdev (8)
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
.I Documentation/admin\-guide/initrd.rst
|
|
Packit |
7cfc04 |
.\" commit 9d85025b0418163fae079c9ba8f8445212de8568
|
|
Packit |
7cfc04 |
(or
|
|
Packit |
7cfc04 |
.I Documentation/initrd.txt
|
|
Packit |
7cfc04 |
before Linux 4.10)
|
|
Packit |
7cfc04 |
in the Linux kernel source tree, the LILO documentation,
|
|
Packit |
7cfc04 |
the LOADLIN documentation, the SYSLINUX documentation
|
|
Packit |
7cfc04 |
.SH COLOPHON
|
|
Packit |
7cfc04 |
This page is part of release 4.15 of the Linux
|
|
Packit |
7cfc04 |
.I man-pages
|
|
Packit |
7cfc04 |
project.
|
|
Packit |
7cfc04 |
A description of the project,
|
|
Packit |
7cfc04 |
information about reporting bugs,
|
|
Packit |
7cfc04 |
and the latest version of this page,
|
|
Packit |
7cfc04 |
can be found at
|
|
Packit |
7cfc04 |
\%https://www.kernel.org/doc/man\-pages/.
|