]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man4/initrd.4
Replaced tabs with spaces
[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
fea681da
MK
37.SH DESCRIPTION
38The special file
8478ee02 39.I /dev/initrd
fea681da
MK
40is a read-only block device.
41Device
8478ee02 42.I /dev/initrd
fea681da
MK
43is a RAM disk that is initialized (e.g. loaded) by the boot loader before
44the kernel is started.
61f4934a 45The kernel then can use the block device
8478ee02 46.IR /dev/initrd "'s "
fea681da
MK
47contents for a two phased system boot-up.
48.PP
49In the first boot-up phase, the kernel starts up
50and mounts an initial root file-system from the contents
51of
8478ee02 52.I /dev/initrd
fea681da
MK
53(e.g. RAM disk initialized by the boot loader).
54In the second phase, additional drivers or other modules
55are loaded from the initial root device's contents.
56After loading the additional modules, a new root file system
57(i.e. the normal root file system) is mounted from a
58different device.
59.\"
60.\"
61.\"
62.SH "BOOT-UP OPERATION"
63When booting up with
64.BR initrd ", the system boots as follows:"
65.RS 0.2i
66.PP
671. The boot loader loads the kernel program and
8478ee02 68.IR /dev/initrd "'s contents into memory."
fea681da 69.PP
8478ee02
MK
702. On kernel startup,
71the kernel uncompresses and copies the contents of the device
72.I /dev/initrd
fea681da 73onto device
8478ee02 74.I /dev/ram0
fea681da 75and then frees the memory used by
8478ee02 76.IR /dev/initrd "."
fea681da
MK
77.PP
783. The kernel then read-write mounts device
8478ee02 79.I /dev/ram0
fea681da
MK
80as the initial root file system.
81.PP
824. If the indicated normal root file system is also the initial root file-system
83(e.g.
8478ee02 84.I /dev/ram0
fea681da
MK
85) then the kernel skips to the last step for the usual boot sequence.
86.PP
875. If the executable file
8478ee02 88.IR /linuxrc " is present in the initial root file-system, " /linuxrc
fdc196f5 89is executed with UID 0.
fea681da 90(The file
8478ee02 91.I /linuxrc
fea681da
MK
92must have executable permission.
93The file
8478ee02 94.I /linuxrc
fea681da
MK
95can be any valid executable, including a shell script.)
96.PP
976. If
8478ee02 98.I /linuxrc
fea681da 99is not executed or when
8478ee02 100.I /linuxrc
fea681da
MK
101terminates, the normal root file system is mounted.
102(If
8478ee02 103.IR /linuxrc
fea681da
MK
104exits with any file-systems mounted on the initial root
105file-system, then the behavior of the kernel is
106.BR UNSPECIFIED "."
107See the
108.BR NOTES
109section for the current kernel behavior.)
110.PP
1117. If the normal root file has directory
8478ee02
MK
112.IR /initrd ", device"
113.I /dev/ram0
fea681da 114is moved from
8478ee02 115.IR / " to " /initrd "."
fea681da 116Otherwise if directory
8478ee02 117.IR /initrd " does not exist device " /dev/ram0 " is unmounted."
fea681da 118(When moved from
8478ee02 119.IR / " to " /initrd ", " /dev/ram0
fea681da 120is not unmounted and therefore processes can remain running from
8478ee02 121.IR /dev/ram0 "."
fea681da 122If directory
8478ee02 123.IR /initrd
fea681da
MK
124does not exist on the normal root file-system
125and any processes remain running from
8478ee02 126.IR /dev/ram0 " when " /linuxrc
fea681da
MK
127exits, the behavior of the kernel is
128.BR UNSPECIFIED "."
129See the
130.BR NOTES
131section for the current kernel behavior.)
132.PP
1338. The usual boot sequence (e.g. invocation of
8478ee02
MK
134.IR /sbin/init )
135is performed on the normal root file system.
fea681da
MK
136.\"
137.\"
138.\"
139.SH OPTIONS
140The following boot loader options when used with
141.BR initrd ", affect the kernel's boot-up operation:"
142.TP
143.BI initrd= "filename"
144Specifies the file to load as the contents of
8478ee02 145.IR /dev/initrd "."
c10859eb
MK
146For
147.B LOADLIN
fea681da 148this is a command line option.
c10859eb
MK
149For
150.B LILO
151you have to use this command in the
152.B LILO
8478ee02
MK
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 228.nf
7295b7ed
MK
229
230 echo 0x365 >/proc/sys/kernel/real-root-dev
231
fea681da
MK
232.fi
233For a NFS example, the following shell command lines would change the
234normal root device to the NFS directory
8478ee02 235.IR /var/nfsroot
fea681da
MK
236on a local networked NFS server with IP number 193.8.232.7 for a system with
237IP number 193.8.232.7 and named 'idefix':
238.nf
7295b7ed
MK
239
240 echo /var/nfsroot >/proc/sys/kernel/nfs-root-name
241 echo 193.8.232.2:193.8.232.7::255.255.255.0:idefix \\
242 >/proc/sys/kernel/nfs-root-addrs
243 echo 255 >/proc/sys/kernel/real-root-dev
fea681da 244.fi
1a57baf2
MK
245
246.BR Note :
247The use of
8478ee02 248.IR /proc/sys/kernel/real-root-dev
1a57baf2
MK
249to change the root file system is obsolete.
250See the kernel source file
251.I Documentation/initrd.txt
252as well as
253.BR pivot_root (2)
254and
255.BR pivot_root (8)
256for information on the modern method of changing the root file system.
257.\" FIXME the manual page should describe the pivot_root mechanism.
fea681da
MK
258.\"
259.\"
260.\"
261.SH USAGE
262The main motivation for implementing
263.BR initrd
264was to allow for modular kernel configuration at system installation.
265.PP
266A possible system installation scenario is as follows:
267.RS 0.2i
268.PP
2691. The loader program boots from floppy or other media with a minimal kernel
270(e.g. support for
8478ee02
MK
271.IR /dev/ram ", " /dev/initrd ", and the ext2 file-system) and loads "
272.IR /dev/initrd " with a gzipped version of the initial file-system.
fea681da
MK
273.PP
2742. The executable
8478ee02 275.IR /linuxrc
fea681da
MK
276determines what is needed to (1) mount the normal root file-system
277(i.e. device type, device drivers, file system) and (2) the
278distribution media (e.g. CD-ROM, network, tape, ...). This can be
279done by asking the user, by auto-probing, or by using a hybrid
280approach.
281.PP
2823. The executable
8478ee02 283.IR /linuxrc
fea681da
MK
284loads the necessary modules from the initial root file-system.
285.PP
2864. The executable
8478ee02 287.IR /linuxrc
fea681da
MK
288creates and populates the root file system. (At this stage the normal
289root file system does not have to be a
290completed system yet.)
291.PP
2925. The executable
8478ee02 293.IR /linuxrc " sets " /proc/sys/kernel/real-root-dev,
fea681da 294unmount
8478ee02 295.IR /proc ", "
fea681da
MK
296the normal root file system and any other file
297systems it has mounted, and then terminates.
298.PP
2996. The kernel then mounts the normal root file system.
300.PP
3017. Now that the file system is accessible and intact,
302the boot loader can be installed.
303.PP
3048. The boot loader is configured to load into
8478ee02 305.IR /dev/initrd
fea681da
MK
306a file system with the set of modules that was used to bring up the system.
307(e.g. Device
8478ee02 308.IR /dev/ram0
fea681da 309can be modified, then unmounted, and finally, the image is written from
8478ee02 310.IR /dev/ram0
fea681da
MK
311to a file.)
312.PP
3139. The system is now bootable and additional installation tasks can be
314performed.
315.RE
316.PP
317The key role of
8478ee02 318.IR /dev/initrd
fea681da
MK
319in the above is to re-use the configuration data during normal system operation
320without requiring initial kernel selection, a large generic kernel or,
321recompiling the kernel.
322.PP
323A second scenario is for installations where Linux runs on systems with
324different hardware configurations in a single administrative network.
325In such cases, it may be desirable to use only a small set of kernels
326(ideally only one) and to keep the system-specific part of configuration
327information as small as possible.
328In this case, create a common file
329with all needed modules.
fba59d25 330Then, only the
8478ee02 331.I /linuxrc
fea681da 332file or a file executed by
8478ee02 333.I /linuxrc
fea681da
MK
334would be different.
335.PP
336A third scenario is more convenient recovery disks.
337Because information like the location of the root file-system
338partition is not needed at boot time, the system loaded from
8478ee02 339.I /dev/initrd
fea681da
MK
340can use a dialog and/or auto-detection followed by a
341possible sanity check.
342.PP
343Last but not least, Linux distributions on CD-ROM may use
344.BR initrd
345for easy installation from the CD-ROM.
346The distribution can use
347.BR LOADLIN
348to directly load
8478ee02 349.IR /dev/initrd
fea681da
MK
350from CD-ROM without the need of any floppies.
351The distribution could also use a
352.BR LILO
353boot floppy and then bootstrap a bigger ram disk via
8478ee02 354.IR /dev/initrd " from the CD-ROM."
fea681da
MK
355.\"
356.\"
357.\"
358.SH CONFIGURATION
359The
8478ee02 360.I /dev/initrd
fea681da
MK
361is a read-only block device assigned
362major number 1 and minor number 250.
363Typically
8478ee02 364.I /dev/initrd
fea681da 365is owned by
8478ee02 366.I root.disk
fea681da
MK
367with mode 0400 (read access by root only).
368If the Linux system does not have
8478ee02 369.I /dev/initrd
fea681da
MK
370already created, it can be created with the following commands:
371.nf
372\fB
2bc2f479 373 mknod \-m 400 /dev/initrd b 1 250
fea681da
MK
374 chown root:disk /dev/initrd
375\fP
376.fi
377Also, support for both "RAM disk" and "Initial RAM disk"
378(e.g.
379.BR CONFIG_BLK_DEV_RAM=y " and " CONFIG_BLK_DEV_INITRD=y
380) support must be compiled directly into the Linux kernel to use
8478ee02 381.IR /dev/initrd "."
fea681da 382When using
8478ee02 383.IR /dev/initrd ", "
fea681da
MK
384the RAM disk driver cannot be loaded as a module.
385.\"
386.\"
387.\"
388.SH FILES
389.I /dev/initrd
390.br
391.I /dev/ram0
392.br
393.I /linuxrc
394.br
395.I /initrd
396.SH "SEE ALSO"
397.BR chown (1),
398.BR mknod (1),
399.BR ram (4),
400.BR freeramdisk (8),
401.BR rdev (8)
402
403The documentation file
404.I initrd.txt
405in the kernel source package, the LILO documentation,
406the LOADLIN documentation, the SYSLINUX documentation.
407.\"
408.\"
409.\"
410.SH NOTES
4111. With the current kernel, any file systems that remain mounted when
8478ee02 412.IR /dev/ram0 " is moved from " / " to " /initrd
fea681da 413continue to be accessible. However, the
8478ee02 414.IR /proc/mounts
fea681da
MK
415entries are not updated.
416.PP
4172. With the current kernel, if directory
8478ee02
MK
418.IR /initrd " does not exist, then "
419.I /dev/ram0
fea681da 420will NOT be fully unmounted if
8478ee02 421.IR /dev/ram0
fea681da
MK
422is used by any process or has any file-system mounted on it.
423If
8478ee02 424.IR /dev/ram0 " is NOT fully unmounted, "
fea681da 425then
8478ee02 426.IR /dev/ram0
fea681da
MK
427will remain in memory.
428.PP
4293. Users of
8478ee02 430.IR /dev/initrd
fea681da
MK
431should not depend on the behavior give in the above notes.
432The behavior may change in future versions of the Linux kernel.
433.\"
434.\"
435.\"
436.SH AUTHOR
437The kernel code for device
438.BR initrd
439was written by Werner Almesberger <almesber@lrc.epfl.ch> and
440Hans Lermen <lermen@elserv.ffm.fgan.de>.
441The code for
442.BR initrd
443was added to the baseline Linux kernel in development version 1.3.73.