]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man4/initrd.4
Various improvements and corrections by Thomas Dickey.
[thirdparty/man-pages.git] / man4 / initrd.4
CommitLineData
fea681da
MK
1.\" -*- nroff -*-
2.\" This man-page is Copyright (C) 1997 John S. Kallal
3.\"
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.
12.\"
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.
20.\"
21.\" Formatted or processed versions of this manual, if unaccompanied by
22.\" the source, must acknowledge the copyright and author(s) of this work.
23.\"
24.\" If the you wish to distribute versions of this work under other
25.\" conditions than the above, please contact the author(s) at the following
26.\" for permission:
27.\"
28.\" John S. Kallal -
29.\" email: <kallal@voicenet.com>
30.\" mail: 518 Kerfoot Farm RD, Wilmington, DE 19803-2444, USA
31.\" phone: (302)654-5478
32.\"
33.\" $Id: initrd.4,v 0.9 1997/11/07 05:05:32 kallal Exp kallal $
34.TH INITRD 4 1997-11-06 "Linux 2.0" "Linux Programmer's Manual"
35.SH NAME
36initrd \- boot loader initialized RAM disk
37.\"
38.\"
39.\"
40.SH DESCRIPTION
41The special file
8478ee02 42.I /dev/initrd
fea681da
MK
43is a read-only block device.
44Device
8478ee02 45.I /dev/initrd
fea681da
MK
46is a RAM disk that is initialized (e.g. loaded) by the boot loader before
47the kernel is started.
61f4934a 48The kernel then can use the block device
8478ee02 49.IR /dev/initrd "'s "
fea681da
MK
50contents for a two phased system boot-up.
51.PP
52In the first boot-up phase, the kernel starts up
53and mounts an initial root file-system from the contents
54of
8478ee02 55.I /dev/initrd
fea681da
MK
56(e.g. RAM disk initialized by the boot loader).
57In the second phase, additional drivers or other modules
58are loaded from the initial root device's contents.
59After loading the additional modules, a new root file system
60(i.e. the normal root file system) is mounted from a
61different device.
62.\"
63.\"
64.\"
65.SH "BOOT-UP OPERATION"
66When booting up with
67.BR initrd ", the system boots as follows:"
68.RS 0.2i
69.PP
701. The boot loader loads the kernel program and
8478ee02 71.IR /dev/initrd "'s contents into memory."
fea681da 72.PP
8478ee02
MK
732. On kernel startup,
74the kernel uncompresses and copies the contents of the device
75.I /dev/initrd
fea681da 76onto device
8478ee02 77.I /dev/ram0
fea681da 78and then frees the memory used by
8478ee02 79.IR /dev/initrd "."
fea681da
MK
80.PP
813. The kernel then read-write mounts device
8478ee02 82.I /dev/ram0
fea681da
MK
83as the initial root file system.
84.PP
854. If the indicated normal root file system is also the initial root file-system
86(e.g.
8478ee02 87.I /dev/ram0
fea681da
MK
88) then the kernel skips to the last step for the usual boot sequence.
89.PP
905. If the executable file
8478ee02 91.IR /linuxrc " is present in the initial root file-system, " /linuxrc
fdc196f5 92is executed with UID 0.
fea681da 93(The file
8478ee02 94.I /linuxrc
fea681da
MK
95must have executable permission.
96The file
8478ee02 97.I /linuxrc
fea681da
MK
98can be any valid executable, including a shell script.)
99.PP
1006. If
8478ee02 101.I /linuxrc
fea681da 102is not executed or when
8478ee02 103.I /linuxrc
fea681da
MK
104terminates, the normal root file system is mounted.
105(If
8478ee02 106.IR /linuxrc
fea681da
MK
107exits with any file-systems mounted on the initial root
108file-system, then the behavior of the kernel is
109.BR UNSPECIFIED "."
110See the
111.BR NOTES
112section for the current kernel behavior.)
113.PP
1147. If the normal root file has directory
8478ee02
MK
115.IR /initrd ", device"
116.I /dev/ram0
fea681da 117is moved from
8478ee02 118.IR / " to " /initrd "."
fea681da 119Otherwise if directory
8478ee02 120.IR /initrd " does not exist device " /dev/ram0 " is unmounted."
fea681da 121(When moved from
8478ee02 122.IR / " to " /initrd ", " /dev/ram0
fea681da 123is not unmounted and therefore processes can remain running from
8478ee02 124.IR /dev/ram0 "."
fea681da 125If directory
8478ee02 126.IR /initrd
fea681da
MK
127does not exist on the normal root file-system
128and any processes remain running from
8478ee02 129.IR /dev/ram0 " when " /linuxrc
fea681da
MK
130exits, the behavior of the kernel is
131.BR UNSPECIFIED "."
132See the
133.BR NOTES
134section for the current kernel behavior.)
135.PP
1368. The usual boot sequence (e.g. invocation of
8478ee02
MK
137.IR /sbin/init )
138is performed on the normal root file system.
fea681da
MK
139.\"
140.\"
141.\"
142.SH OPTIONS
143The following boot loader options when used with
144.BR initrd ", affect the kernel's boot-up operation:"
145.TP
146.BI initrd= "filename"
147Specifies the file to load as the contents of
8478ee02 148.IR /dev/initrd "."
fea681da
MK
149.RB "For " LOADLIN
150this is a command line option.
151.RB "For " LILO " you have to use this command in the
8478ee02
MK
152.BR LILO
153configuration file
154.IR /etc/lilo.config .
fea681da
MK
155The filename specified with this
156option will typically be a gzipped file-system image.
157.TP
8478ee02 158.I noinitrd
fea681da
MK
159This boot time option disables the two phase boot-up operation.
160The kernel performs the usual boot sequence as if
8478ee02 161.I /dev/initrd
fea681da
MK
162was not initialized.
163With this option, any contents of
8478ee02 164.I /dev/initrd
fea681da
MK
165loaded into memory by the boot loader contents are preserved.
166This option permits the contents of
8478ee02 167.I /dev/initrd
fea681da
MK
168to be any data and need not be limited to a file system image.
169However, device
8478ee02 170.I /dev/initrd
fea681da
MK
171is read-only and can be read only one time after system startup.
172.TP
173.BI root= "device-name"
174Specifies the device to be used as the normal root file system.
175.RB "For " LOADLIN
176this is a command line option.
177.RB "For " LILO " this is a boot time option or
178can be used as an option line in the
179.BR LILO " configuration file " /etc/lilo.config "."
180The device specified by the this option must be a mountable
181device having a suitable root file-system.
182.\"
183.\"
184.\"
185.SH "CHANGING THE NORMAL ROOT FILE SYSTEM"
186By default,
187the kernel's settings
188(e.g. set in the kernel file with
8478ee02 189.BR rdev (8)
fea681da
MK
190or compiled into the kernel file),
191or the boot loader option setting
192is used for the normal root file systems.
193For a NFS-mounted normal root file system, one has to use the
194.BR nfs_root_name " and " nfs_root_addrs
195boot options to give the NFS settings.
196For more information on NFS-mounted root see the kernel documentation file
197.BR nfsroot.txt "."
198For more information on setting the root file system also see the
199.BR LILO " and " LOADLIN " documentation."
200.PP
201It is also possible for the
8478ee02 202.IR /linuxrc
fea681da
MK
203executable to change the normal root device.
204For
8478ee02 205.IR /linuxrc
fea681da 206to change the normal root device,
8478ee02 207.IR /proc " must be mounted."
fea681da 208After mounting
8478ee02 209.IR /proc ", " /linuxrc
fea681da 210changes the normal root device by writing into the proc files
8478ee02
MK
211.IR /proc/sys/kernel/real-root-dev ", "
212.IR /proc/sys/kernel/nfs-root-name ", and "
213.IR /proc/sys/kernel/nfs-root-addrs "."
fea681da 214For a physical root device, the root device is changed by having
8478ee02 215.IR /linuxrc
fea681da 216write the new root file system device number into
8478ee02 217.IR /proc/sys/kernel/real-root-dev "."
fea681da 218For a NFS root file system, the root device is changed by having
8478ee02 219.IR /linuxrc
fea681da 220write the NFS setting into files
8478ee02
MK
221.IR /proc/sys/kernel/nfs-root-name " and "
222.IR /proc/sys/kernel/nfs-root-addrs
fea681da 223and then writing 0xff (e.g. the pseudo-NFS-device number) into file
8478ee02 224.IR /proc/sys/kernel/real-root-dev "."
fea681da
MK
225For example, the following shell command line would change
226the normal root device to
8478ee02 227.IR /dev/hdb1 :
fea681da
MK
228.nf
229 echo 0x365 >/proc/sys/kernel/real-root-dev
230.fi
231For a NFS example, the following shell command lines would change the
232normal root device to the NFS directory
8478ee02 233.IR /var/nfsroot
fea681da
MK
234on a local networked NFS server with IP number 193.8.232.7 for a system with
235IP number 193.8.232.7 and named 'idefix':
236.nf
237 echo /var/nfsroot >/proc/sys/kernel/nfs-root-name
238 echo 193.8.232.2:193.8.232.7::255.255.255.0:idefix \\
239 >/proc/sys/kernel/nfs-root-addrs
240 echo 255 >/proc/sys/kernel/real-root-dev
241.fi
1a57baf2
MK
242
243.BR Note :
244The use of
8478ee02 245.IR /proc/sys/kernel/real-root-dev
1a57baf2
MK
246to change the root file system is obsolete.
247See the kernel source file
248.I Documentation/initrd.txt
249as well as
250.BR pivot_root (2)
251and
252.BR pivot_root (8)
253for information on the modern method of changing the root file system.
254.\" FIXME the manual page should describe the pivot_root mechanism.
fea681da
MK
255.\"
256.\"
257.\"
258.SH USAGE
259The main motivation for implementing
260.BR initrd
261was to allow for modular kernel configuration at system installation.
262.PP
263A possible system installation scenario is as follows:
264.RS 0.2i
265.PP
2661. The loader program boots from floppy or other media with a minimal kernel
267(e.g. support for
8478ee02
MK
268.IR /dev/ram ", " /dev/initrd ", and the ext2 file-system) and loads "
269.IR /dev/initrd " with a gzipped version of the initial file-system.
fea681da
MK
270.PP
2712. The executable
8478ee02 272.IR /linuxrc
fea681da
MK
273determines what is needed to (1) mount the normal root file-system
274(i.e. device type, device drivers, file system) and (2) the
275distribution media (e.g. CD-ROM, network, tape, ...). This can be
276done by asking the user, by auto-probing, or by using a hybrid
277approach.
278.PP
2793. The executable
8478ee02 280.IR /linuxrc
fea681da
MK
281loads the necessary modules from the initial root file-system.
282.PP
2834. The executable
8478ee02 284.IR /linuxrc
fea681da
MK
285creates and populates the root file system. (At this stage the normal
286root file system does not have to be a
287completed system yet.)
288.PP
2895. The executable
8478ee02 290.IR /linuxrc " sets " /proc/sys/kernel/real-root-dev,
fea681da 291unmount
8478ee02 292.IR /proc ", "
fea681da
MK
293the normal root file system and any other file
294systems it has mounted, and then terminates.
295.PP
2966. The kernel then mounts the normal root file system.
297.PP
2987. Now that the file system is accessible and intact,
299the boot loader can be installed.
300.PP
3018. The boot loader is configured to load into
8478ee02 302.IR /dev/initrd
fea681da
MK
303a file system with the set of modules that was used to bring up the system.
304(e.g. Device
8478ee02 305.IR /dev/ram0
fea681da 306can be modified, then unmounted, and finally, the image is written from
8478ee02 307.IR /dev/ram0
fea681da
MK
308to a file.)
309.PP
3109. The system is now bootable and additional installation tasks can be
311performed.
312.RE
313.PP
314The key role of
8478ee02 315.IR /dev/initrd
fea681da
MK
316in the above is to re-use the configuration data during normal system operation
317without requiring initial kernel selection, a large generic kernel or,
318recompiling the kernel.
319.PP
320A second scenario is for installations where Linux runs on systems with
321different hardware configurations in a single administrative network.
322In such cases, it may be desirable to use only a small set of kernels
323(ideally only one) and to keep the system-specific part of configuration
324information as small as possible.
325In this case, create a common file
326with all needed modules.
fba59d25 327Then, only the
8478ee02 328.I /linuxrc
fea681da 329file or a file executed by
8478ee02 330.I /linuxrc
fea681da
MK
331would be different.
332.PP
333A third scenario is more convenient recovery disks.
334Because information like the location of the root file-system
335partition is not needed at boot time, the system loaded from
8478ee02 336.I /dev/initrd
fea681da
MK
337can use a dialog and/or auto-detection followed by a
338possible sanity check.
339.PP
340Last but not least, Linux distributions on CD-ROM may use
341.BR initrd
342for easy installation from the CD-ROM.
343The distribution can use
344.BR LOADLIN
345to directly load
8478ee02 346.IR /dev/initrd
fea681da
MK
347from CD-ROM without the need of any floppies.
348The distribution could also use a
349.BR LILO
350boot floppy and then bootstrap a bigger ram disk via
8478ee02 351.IR /dev/initrd " from the CD-ROM."
fea681da
MK
352.\"
353.\"
354.\"
355.SH CONFIGURATION
356The
8478ee02 357.I /dev/initrd
fea681da
MK
358is a read-only block device assigned
359major number 1 and minor number 250.
360Typically
8478ee02 361.I /dev/initrd
fea681da 362is owned by
8478ee02 363.I root.disk
fea681da
MK
364with mode 0400 (read access by root only).
365If the Linux system does not have
8478ee02 366.I /dev/initrd
fea681da
MK
367already created, it can be created with the following commands:
368.nf
369\fB
2bc2f479 370 mknod \-m 400 /dev/initrd b 1 250
fea681da
MK
371 chown root:disk /dev/initrd
372\fP
373.fi
374Also, support for both "RAM disk" and "Initial RAM disk"
375(e.g.
376.BR CONFIG_BLK_DEV_RAM=y " and " CONFIG_BLK_DEV_INITRD=y
377) support must be compiled directly into the Linux kernel to use
8478ee02 378.IR /dev/initrd "."
fea681da 379When using
8478ee02 380.IR /dev/initrd ", "
fea681da
MK
381the RAM disk driver cannot be loaded as a module.
382.\"
383.\"
384.\"
385.SH FILES
386.I /dev/initrd
387.br
388.I /dev/ram0
389.br
390.I /linuxrc
391.br
392.I /initrd
393.SH "SEE ALSO"
394.BR chown (1),
395.BR mknod (1),
396.BR ram (4),
397.BR freeramdisk (8),
398.BR rdev (8)
399
400The documentation file
401.I initrd.txt
402in the kernel source package, the LILO documentation,
403the LOADLIN documentation, the SYSLINUX documentation.
404.\"
405.\"
406.\"
407.SH NOTES
4081. With the current kernel, any file systems that remain mounted when
8478ee02 409.IR /dev/ram0 " is moved from " / " to " /initrd
fea681da 410continue to be accessible. However, the
8478ee02 411.IR /proc/mounts
fea681da
MK
412entries are not updated.
413.PP
4142. With the current kernel, if directory
8478ee02
MK
415.IR /initrd " does not exist, then "
416.I /dev/ram0
fea681da 417will NOT be fully unmounted if
8478ee02 418.IR /dev/ram0
fea681da
MK
419is used by any process or has any file-system mounted on it.
420If
8478ee02 421.IR /dev/ram0 " is NOT fully unmounted, "
fea681da 422then
8478ee02 423.IR /dev/ram0
fea681da
MK
424will remain in memory.
425.PP
4263. Users of
8478ee02 427.IR /dev/initrd
fea681da
MK
428should not depend on the behavior give in the above notes.
429The behavior may change in future versions of the Linux kernel.
430.\"
431.\"
432.\"
433.SH AUTHOR
434The kernel code for device
435.BR initrd
436was written by Werner Almesberger <almesber@lrc.epfl.ch> and
437Hans Lermen <lermen@elserv.ffm.fgan.de>.
438The code for
439.BR initrd
440was added to the baseline Linux kernel in development version 1.3.73.