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