]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man4/initrd.4
sk98lin.4: wfix
[thirdparty/man-pages.git] / man4 / initrd.4
CommitLineData
fea681da
MK
1.\" This man-page is Copyright (C) 1997 John S. Kallal
2.\"
93015253 3.\" %%%LICENSE_START(VERBATIM)
fea681da
MK
4.\" Permission is granted to make and distribute verbatim copies of this
5.\" manual provided the copyright notice and this permission notice are
6.\" preserved on all copies.
7.\"
8.\" Permission is granted to copy and distribute modified versions of this
9.\" manual under the conditions for verbatim copying, provided that the
10.\" entire resulting derived work is distributed under the terms of a
11.\" permission notice identical to this one.
c13182ef 12.\"
fea681da
MK
13.\" Since the Linux kernel and libraries are constantly changing, this
14.\" manual page may be incorrect or out-of-date. The author(s) assume no
15.\" responsibility for errors or omissions, or for damages resulting from
16.\" the use of the information contained herein. The author(s) may not
17.\" have taken the same level of care in the production of this manual,
18.\" which is licensed free of charge, as they might when working
19.\" professionally.
c13182ef 20.\"
fea681da
MK
21.\" Formatted or processed versions of this manual, if unaccompanied by
22.\" the source, must acknowledge the copyright and author(s) of this work.
4b72fb64 23.\" %%%LICENSE_END
fea681da
MK
24.\"
25.\" If the you wish to distribute versions of this work under other
c13182ef 26.\" conditions than the above, please contact the author(s) at the following
fea681da 27.\" for permission:
988db661 28.\"
c13182ef 29.\" John S. Kallal -
fea681da
MK
30.\" email: <kallal@voicenet.com>
31.\" mail: 518 Kerfoot Farm RD, Wilmington, DE 19803-2444, USA
32.\" phone: (302)654-5478
c13182ef 33.\"
fea681da 34.\" $Id: initrd.4,v 0.9 1997/11/07 05:05:32 kallal Exp kallal $
72542487 35.TH INITRD 4 2010-09-04 "Linux" "Linux Programmer's Manual"
fea681da
MK
36.SH NAME
37initrd \- boot loader initialized RAM disk
1351674a
MK
38.SH CONFIGURATION
39The
40.I /dev/initrd
41is a read-only block device assigned
42major number 1 and minor number 250.
43Typically
44.I /dev/initrd
45is owned by
46.I root.disk
47with mode 0400 (read access by root only).
48If the Linux system does not have
49.I /dev/initrd
50already created, it can be created with the following commands:
51.nf
52\fB
53 mknod \-m 400 /dev/initrd b 1 250
54 chown root:disk /dev/initrd
55\fP
56.fi
57.PP
58Also, support for both "RAM disk" and "Initial RAM disk"
15079abb 59(e.g.,
616e3430 60.BR CONFIG_BLK_DEV_RAM=y
c342a49b
MK
61and
62.BR CONFIG_BLK_DEV_INITRD=y )
1351674a 63must be compiled directly into the Linux kernel to use
c342a49b 64.IR /dev/initrd .
1351674a 65When using
c342a49b 66.IR /dev/initrd ,
1351674a
MK
67the RAM disk driver cannot be loaded as a module.
68.\"
69.\"
70.\"
fea681da 71.SH DESCRIPTION
c13182ef
MK
72The special file
73.I /dev/initrd
74is a read-only block device.
b644cdd7
MK
75This device is a RAM disk that is initialized (e.g., loaded)
76by the boot loader before the kernel is started.
77The kernel then can use
c13182ef 78.IR /dev/initrd "'s "
b644cdd7 79contents for a two-phase system boot-up.
fea681da 80.PP
c13182ef 81In the first boot-up phase, the kernel starts up
b644cdd7 82and mounts an initial root file-system from the contents of
c13182ef 83.I /dev/initrd
1930dbe6 84(e.g., RAM disk initialized by the boot loader).
c13182ef
MK
85In the second phase, additional drivers or other modules
86are loaded from the initial root device's contents.
87After loading the additional modules, a new root file system
75b94dc3 88(i.e., the normal root file system) is mounted from a
fea681da
MK
89different device.
90.\"
91.\"
92.\"
73d8cece 93.SS Boot-up operation
c13182ef 94When booting up with
c342a49b
MK
95.BR initrd ,
96the system boots as follows:
c4fd8ad8
MK
97.IP 1. 3
98The boot loader loads the kernel program and
c342a49b
MK
99.IR /dev/initrd 's
100contents into memory.
ea7366cd 101.IP 2.
c4fd8ad8 102On kernel startup,
c13182ef 103the kernel uncompresses and copies the contents of the device
8478ee02 104.I /dev/initrd
c13182ef
MK
105onto device
106.I /dev/ram0
107and then frees the memory used by
c342a49b 108.IR /dev/initrd .
c4fd8ad8 109.IP 3.
b644cdd7 110The kernel then read-write mounts the device
c13182ef 111.I /dev/ram0
fea681da 112as the initial root file system.
c4fd8ad8 113.IP 4.
b644cdd7 114If the indicated normal root file system is also the initial
15079abb 115root file-system (e.g.,
b644cdd7
MK
116.IR /dev/ram0 )
117then the kernel skips to the last step for the usual boot sequence.
c4fd8ad8
MK
118.IP 5.
119If the executable file
c342a49b
MK
120.IR /linuxrc
121is present in the initial root file-system,
122.I /linuxrc
c13182ef
MK
123is executed with UID 0.
124(The file
8478ee02 125.I /linuxrc
c13182ef
MK
126must have executable permission.
127The file
8478ee02 128.I /linuxrc
c13182ef 129can be any valid executable, including a shell script.)
c4fd8ad8
MK
130.IP 6.
131If
8478ee02 132.I /linuxrc
c13182ef 133is not executed or when
8478ee02 134.I /linuxrc
c13182ef 135terminates, the normal root file system is mounted.
fea681da 136(If
0daa9e92 137.I /linuxrc
c13182ef
MK
138exits with any file-systems mounted on the initial root
139file-system, then the behavior of the kernel is
c342a49b 140.BR UNSPECIFIED .
3d341b33 141See the NOTES section for the current kernel behavior.)
c4fd8ad8 142.IP 7.
b644cdd7 143If the normal root file system has a directory
c342a49b 144.IR /initrd ,
b644cdd7 145the device
8478ee02 146.I /dev/ram0
c13182ef 147is moved from
c342a49b
MK
148.IR /
149to
150.IR /initrd .
b644cdd7 151Otherwise if the directory
616e3430 152.IR /initrd
b644cdd7 153does not exist, the device
c342a49b
MK
154.I /dev/ram0
155is unmounted.
c13182ef 156(When moved from
c342a49b 157.IR /
616e3430
MK
158to
159.IR /initrd ,
c342a49b 160.I /dev/ram0
c13182ef 161is not unmounted and therefore processes can remain running from
c342a49b 162.IR /dev/ram0 .
c13182ef 163If directory
0daa9e92 164.I /initrd
b644cdd7 165does not exist on the normal root file system
c13182ef 166and any processes remain running from
616e3430 167.IR /dev/ram0
c342a49b
MK
168when
169.I /linuxrc
c13182ef 170exits, the behavior of the kernel is
c342a49b 171.BR UNSPECIFIED .
3d341b33 172See the NOTES section for the current kernel behavior.)
c4fd8ad8 173.IP 8.
ade562fb 174The usual boot sequence (e.g., invocation of
8478ee02
MK
175.IR /sbin/init )
176is performed on the normal root file system.
c13182ef
MK
177.\"
178.\"
179.\"
c4fd8ad8 180.SS Options
b644cdd7 181The following boot loader options, when used with
c342a49b
MK
182.BR initrd ,
183affect the kernel's boot-up operation:
fea681da
MK
184.TP
185.BI initrd= "filename"
c13182ef 186Specifies the file to load as the contents of
c342a49b 187.IR /dev/initrd .
c10859eb 188For
c13182ef 189.B LOADLIN
76c44d83 190this is a command-line option.
c13182ef
MK
191For
192.B LILO
193you have to use this command in the
194.B LILO
195configuration file
8478ee02 196.IR /etc/lilo.config .
fea681da
MK
197The filename specified with this
198option will typically be a gzipped file-system image.
199.TP
8478ee02 200.I noinitrd
b644cdd7 201This boot option disables the two-phase boot-up operation.
c13182ef
MK
202The kernel performs the usual boot sequence as if
203.I /dev/initrd
204was not initialized.
fea681da 205With this option, any contents of
c13182ef 206.I /dev/initrd
fea681da 207loaded into memory by the boot loader contents are preserved.
c13182ef
MK
208This option permits the contents of
209.I /dev/initrd
210to be any data and need not be limited to a file system image.
211However, device
8478ee02 212.I /dev/initrd
fea681da
MK
213is read-only and can be read only one time after system startup.
214.TP
215.BI root= "device-name"
c13182ef 216Specifies the device to be used as the normal root file system.
c342a49b
MK
217For
218.B LOADLIN
76c44d83 219this is a command-line option.
c342a49b
MK
220For
221.B LILO
222this is a boot time option or
c13182ef 223can be used as an option line in the
c342a49b 224.B LILO
616e3430 225configuration file
c342a49b 226.IR /etc/lilo.config .
c13182ef 227The device specified by the this option must be a mountable
fea681da 228device having a suitable root file-system.
c13182ef
MK
229.\"
230.\"
231.\"
73d8cece 232.SS Changing the normal root file system
c13182ef 233By default,
fea681da 234the kernel's settings
ade562fb 235(e.g., set in the kernel file with
8478ee02 236.BR rdev (8)
fea681da
MK
237or compiled into the kernel file),
238or the boot loader option setting
239is used for the normal root file systems.
b644cdd7 240For an NFS-mounted normal root file system, one has to use the
616e3430 241.B nfs_root_name
c342a49b
MK
242and
243.B nfs_root_addrs
c13182ef 244boot options to give the NFS settings.
fea681da 245For more information on NFS-mounted root see the kernel documentation file
b644cdd7
MK
246.BR Documentation/filesystems/nfsroot.txt .
247For more information on setting the root file system see also the
c342a49b
MK
248.BR LILO
249and
2e9cee8a 250.BR LOADLIN
c342a49b 251documentation.
fea681da 252.PP
c13182ef 253It is also possible for the
0daa9e92 254.I /linuxrc
fea681da 255executable to change the normal root device.
c13182ef 256For
0daa9e92 257.I /linuxrc
c13182ef 258to change the normal root device,
616e3430 259.IR /proc
c342a49b 260must be mounted.
c13182ef 261After mounting
c342a49b
MK
262.IR /proc ,
263.I /linuxrc
fea681da 264changes the normal root device by writing into the proc files
616e3430 265.IR /proc/sys/kernel/real-root-dev ,
c342a49b
MK
266.IR /proc/sys/kernel/nfs-root-name ,
267and
268.IR /proc/sys/kernel/nfs-root-addrs .
fea681da 269For a physical root device, the root device is changed by having
0daa9e92 270.I /linuxrc
fea681da 271write the new root file system device number into
c342a49b 272.IR /proc/sys/kernel/real-root-dev .
b644cdd7 273For an NFS root file system, the root device is changed by having
0daa9e92 274.I /linuxrc
fea681da 275write the NFS setting into files
c342a49b
MK
276.IR /proc/sys/kernel/nfs-root-name
277and
0daa9e92 278.I /proc/sys/kernel/nfs-root-addrs
ade562fb 279and then writing 0xff (e.g., the pseudo-NFS-device number) into file
c342a49b 280.IR /proc/sys/kernel/real-root-dev .
fea681da 281For example, the following shell command line would change
c13182ef 282the normal root device to
8478ee02 283.IR /dev/hdb1 :
fea681da 284.nf
7295b7ed
MK
285
286 echo 0x365 >/proc/sys/kernel/real-root-dev
287
fea681da 288.fi
b644cdd7 289For an NFS example, the following shell command lines would change the
c13182ef 290normal root device to the NFS directory
0daa9e92 291.I /var/nfsroot
c13182ef 292on a local networked NFS server with IP number 193.8.232.7 for a system with
0ab92df8 293IP number 193.8.232.2 and named "idefix":
fea681da 294.nf
7295b7ed
MK
295
296 echo /var/nfsroot >/proc/sys/kernel/nfs-root-name
297 echo 193.8.232.2:193.8.232.7::255.255.255.0:idefix \\
298 >/proc/sys/kernel/nfs-root-addrs
299 echo 255 >/proc/sys/kernel/real-root-dev
fea681da 300.fi
1a57baf2
MK
301
302.BR Note :
303The use of
0daa9e92 304.I /proc/sys/kernel/real-root-dev
1a57baf2 305to change the root file system is obsolete.
66a9882e 306See the Linux kernel source file
1a57baf2
MK
307.I Documentation/initrd.txt
308as well as
309.BR pivot_root (2)
310and
311.BR pivot_root (8)
c13182ef 312for information on the modern method of changing the root file system.
1a57baf2 313.\" FIXME the manual page should describe the pivot_root mechanism.
c13182ef
MK
314.\"
315.\"
316.\"
c4fd8ad8 317.SS Usage
c13182ef 318The main motivation for implementing
0daa9e92 319.B initrd
c13182ef 320was to allow for modular kernel configuration at system installation.
fea681da
MK
321.PP
322A possible system installation scenario is as follows:
c4fd8ad8
MK
323.IP 1. 3
324The loader program boots from floppy or other media with a minimal kernel
ade562fb 325(e.g., support for
616e3430 326.IR /dev/ram ,
c342a49b
MK
327.IR /dev/initrd ,
328and the ext2 file-system) and loads
329.IR /dev/initrd
330with a gzipped version of the initial file-system.
c4fd8ad8
MK
331.IP 2.
332The executable
0daa9e92 333.I /linuxrc
fea681da 334determines what is needed to (1) mount the normal root file-system
75b94dc3 335(i.e., device type, device drivers, file system) and (2) the
ade562fb 336distribution media (e.g., CD-ROM, network, tape, ...).
b644cdd7
MK
337This can be done by asking the user, by auto-probing,
338or by using a hybrid approach.
c4fd8ad8
MK
339.IP 3.
340The executable
0daa9e92 341.I /linuxrc
fea681da 342loads the necessary modules from the initial root file-system.
c4fd8ad8
MK
343.IP 4.
344The executable
0daa9e92 345.I /linuxrc
c13182ef
MK
346creates and populates the root file system.
347(At this stage the normal root file system does not have to be a
fea681da 348completed system yet.)
c4fd8ad8
MK
349.IP 5.
350The executable
c342a49b
MK
351.IR /linuxrc
352sets
353.IR /proc/sys/kernel/real-root-dev ,
c13182ef 354unmount
c342a49b 355.IR /proc ,
fea681da
MK
356the normal root file system and any other file
357systems it has mounted, and then terminates.
c342a49b
MK
358.IP 6.
359The kernel then mounts the normal root file system.
c4fd8ad8
MK
360.IP 7.
361Now that the file system is accessible and intact,
fea681da 362the boot loader can be installed.
c4fd8ad8
MK
363.IP 8.
364The boot loader is configured to load into
0daa9e92 365.I /dev/initrd
c13182ef 366a file system with the set of modules that was used to bring up the system.
ade562fb 367(e.g., Device
0daa9e92 368.I /dev/ram0
fea681da 369can be modified, then unmounted, and finally, the image is written from
0daa9e92 370.I /dev/ram0
fea681da 371to a file.)
c4fd8ad8
MK
372.IP 9.
373The system is now bootable and additional installation tasks can be
fea681da 374performed.
fea681da 375.PP
c13182ef 376The key role of
0daa9e92 377.I /dev/initrd
3b777aff 378in the above is to reuse the configuration data during normal system operation
fea681da
MK
379without requiring initial kernel selection, a large generic kernel or,
380recompiling the kernel.
381.PP
382A second scenario is for installations where Linux runs on systems with
c13182ef 383different hardware configurations in a single administrative network.
fea681da
MK
384In such cases, it may be desirable to use only a small set of kernels
385(ideally only one) and to keep the system-specific part of configuration
c13182ef
MK
386information as small as possible.
387In this case, create a common file
388with all needed modules.
389Then, only the
8478ee02 390.I /linuxrc
fea681da 391file or a file executed by
8478ee02 392.I /linuxrc
fea681da
MK
393would be different.
394.PP
c13182ef
MK
395A third scenario is more convenient recovery disks.
396Because information like the location of the root file-system
397partition is not needed at boot time, the system loaded from
398.I /dev/initrd
399can use a dialog and/or auto-detection followed by a
fea681da
MK
400possible sanity check.
401.PP
c13182ef 402Last but not least, Linux distributions on CD-ROM may use
0daa9e92 403.B initrd
c13182ef
MK
404for easy installation from the CD-ROM.
405The distribution can use
0daa9e92 406.B LOADLIN
c13182ef 407to directly load
0daa9e92 408.I /dev/initrd
fea681da 409from CD-ROM without the need of any floppies.
c13182ef 410The distribution could also use a
0daa9e92 411.B LILO
b083bb64 412boot floppy and then bootstrap a bigger RAM disk via
c342a49b
MK
413.IR /dev/initrd
414from the CD-ROM.
c13182ef
MK
415.\"
416.\"
417.\"
25768803
MK
418.SH FILES
419.I /dev/initrd
420.br
421.I /dev/ram0
422.br
423.I /linuxrc
424.br
425.I /initrd
426.\"
427.\"
428.\"
fea681da 429.SH NOTES
c4fd8ad8
MK
430.IP 1. 3
431With the current kernel, any file systems that remain mounted when
c342a49b
MK
432.I /dev/ram0
433is moved from
434.I /
435to
436.I /initrd
c13182ef
MK
437continue to be accessible.
438However, the
0daa9e92 439.I /proc/mounts
c13182ef 440entries are not updated.
c4fd8ad8
MK
441.IP 2.
442With the current kernel, if directory
c342a49b
MK
443.I /initrd
444does not exist, then
c13182ef 445.I /dev/ram0
118d6caa 446will
4bd8c614
MK
447.B not
448be fully unmounted if
0daa9e92 449.I /dev/ram0
fea681da 450is used by any process or has any file-system mounted on it.
c13182ef 451If
c342a49b
MK
452.IR /dev/ram0
453is
4bd8c614 454.B not
c342a49b 455fully unmounted, then
0daa9e92 456.I /dev/ram0
fea681da 457will remain in memory.
c4fd8ad8
MK
458.IP 3.
459Users of
0daa9e92 460.I /dev/initrd
c13182ef 461should not depend on the behavior give in the above notes.
fea681da 462The behavior may change in future versions of the Linux kernel.
c13182ef
MK
463.\"
464.\"
465.\"
d2dc6294
MK
466.\" .SH AUTHORS
467.\" The kernel code for device
468.\" .BR initrd
469.\" was written by Werner Almesberger <almesber@lrc.epfl.ch> and
470.\" Hans Lermen <lermen@elserv.ffm.fgan.de>.
471.\" The code for
472.\" .BR initrd
473.\" was added to the baseline Linux kernel in development version 1.3.73.
47297adb 474.SH SEE ALSO
e37e3282
MK
475.BR chown (1),
476.BR mknod (1),
477.BR ram (4),
478.BR freeramdisk (8),
479.BR rdev (8)
480
173fe7e7
DP
481.I Documentation/initrd.txt
482in the Linux kernel source tree, the LILO documentation,
483the LOADLIN documentation, the SYSLINUX documentation