2 .\" This man-page is Copyright (C) 1997 John S. Kallal
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.
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.
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
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and author(s) of this work.
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
29 .\" email: <kallal@voicenet.com>
30 .\" mail: 518 Kerfoot Farm RD, Wilmington, DE 19803-2444, USA
31 .\" phone: (302)654-5478
33 .\" $Id: initrd.4,v 0.9 1997/11/07 05:05:32 kallal Exp kallal $
34 .TH INITRD 4 2010-09-04 "Linux" "Linux Programmer's Manual"
36 initrd \- boot loader initialized RAM disk
40 is a read-only block device assigned
41 major number 1 and minor number 250.
46 with mode 0400 (read access by root only).
47 If the Linux system does not have
49 already created, it can be created with the following commands:
52 mknod \-m 400 /dev/initrd b 1 250
53 chown root:disk /dev/initrd
57 Also, support for both "RAM disk" and "Initial RAM disk"
59 .BR CONFIG_BLK_DEV_RAM=y
61 .BR CONFIG_BLK_DEV_INITRD=y )
62 must be compiled directly into the Linux kernel to use
66 the RAM disk driver cannot be loaded as a module.
73 is a read-only block device.
74 This device is a RAM disk that is initialized (e.g., loaded)
75 by the boot loader before the kernel is started.
76 The kernel then can use
78 contents for a two-phase system boot-up.
80 In the first boot-up phase, the kernel starts up
81 and mounts an initial root file-system from the contents of
83 (e.g., RAM disk initialized by the boot loader).
84 In the second phase, additional drivers or other modules
85 are loaded from the initial root device's contents.
86 After loading the additional modules, a new root file system
87 (i.e., the normal root file system) is mounted from a
92 .SS "Boot-up Operation"
95 the system boots as follows:
97 The boot loader loads the kernel program and
102 the kernel uncompresses and copies the contents of the device
106 and then frees the memory used by
109 The kernel then read-write mounts the device
111 as the initial root file system.
113 If the indicated normal root file system is also the initial
114 root file-system (e.g.,
116 then the kernel skips to the last step for the usual boot sequence.
118 If the executable file
120 is present in the initial root file-system,
122 is executed with UID 0.
125 must have executable permission.
128 can be any valid executable, including a shell script.)
132 is not executed or when
134 terminates, the normal root file system is mounted.
137 exits with any file-systems mounted on the initial root
138 file-system, then the behavior of the kernel is
140 See the NOTES section for the current kernel behavior.)
142 If the normal root file system has a directory
150 Otherwise if the directory
152 does not exist, the device
160 is not unmounted and therefore processes can remain running from
164 does not exist on the normal root file system
165 and any processes remain running from
169 exits, the behavior of the kernel is
171 See the NOTES section for the current kernel behavior.)
173 The usual boot sequence (e.g., invocation of
175 is performed on the normal root file system.
180 The following boot loader options, when used with
182 affect the kernel's boot-up operation:
184 .BI initrd= "filename"
185 Specifies the file to load as the contents of
189 this is a command-line option.
192 you have to use this command in the
195 .IR /etc/lilo.config .
196 The filename specified with this
197 option will typically be a gzipped file-system image.
200 This boot option disables the two-phase boot-up operation.
201 The kernel performs the usual boot sequence as if
204 With this option, any contents of
206 loaded into memory by the boot loader contents are preserved.
207 This option permits the contents of
209 to be any data and need not be limited to a file system image.
212 is read-only and can be read only one time after system startup.
214 .BI root= "device-name"
215 Specifies the device to be used as the normal root file system.
218 this is a command-line option.
221 this is a boot time option or
222 can be used as an option line in the
225 .IR /etc/lilo.config .
226 The device specified by the this option must be a mountable
227 device having a suitable root file-system.
231 .SS "Changing the Normal Root File System"
233 the kernel's settings
234 (e.g., set in the kernel file with
236 or compiled into the kernel file),
237 or the boot loader option setting
238 is used for the normal root file systems.
239 For an NFS-mounted normal root file system, one has to use the
243 boot options to give the NFS settings.
244 For more information on NFS-mounted root see the kernel documentation file
245 .BR Documentation/filesystems/nfsroot.txt .
246 For more information on setting the root file system see also the
252 It is also possible for the
254 executable to change the normal root device.
257 to change the normal root device,
263 changes the normal root device by writing into the proc files
264 .IR /proc/sys/kernel/real-root-dev ,
265 .IR /proc/sys/kernel/nfs-root-name ,
267 .IR /proc/sys/kernel/nfs-root-addrs .
268 For a physical root device, the root device is changed by having
270 write the new root file system device number into
271 .IR /proc/sys/kernel/real-root-dev .
272 For an NFS root file system, the root device is changed by having
274 write the NFS setting into files
275 .IR /proc/sys/kernel/nfs-root-name
277 .I /proc/sys/kernel/nfs-root-addrs
278 and then writing 0xff (e.g., the pseudo-NFS-device number) into file
279 .IR /proc/sys/kernel/real-root-dev .
280 For example, the following shell command line would change
281 the normal root device to
285 echo 0x365 >/proc/sys/kernel/real-root-dev
288 For an NFS example, the following shell command lines would change the
289 normal root device to the NFS directory
291 on a local networked NFS server with IP number 193.8.232.7 for a system with
292 IP number 193.8.232.2 and named "idefix":
295 echo /var/nfsroot >/proc/sys/kernel/nfs-root-name
296 echo 193.8.232.2:193.8.232.7::255.255.255.0:idefix \\
297 >/proc/sys/kernel/nfs-root-addrs
298 echo 255 >/proc/sys/kernel/real-root-dev
303 .I /proc/sys/kernel/real-root-dev
304 to change the root file system is obsolete.
305 See the kernel source file
306 .I Documentation/initrd.txt
311 for information on the modern method of changing the root file system.
312 .\" FIXME the manual page should describe the pivot_root mechanism.
317 The main motivation for implementing
319 was to allow for modular kernel configuration at system installation.
321 A possible system installation scenario is as follows:
323 The loader program boots from floppy or other media with a minimal kernel
327 and the ext2 file-system) and loads
329 with a gzipped version of the initial file-system.
333 determines what is needed to (1) mount the normal root file-system
334 (i.e., device type, device drivers, file system) and (2) the
335 distribution media (e.g., CD-ROM, network, tape, ...).
336 This can be done by asking the user, by auto-probing,
337 or by using a hybrid approach.
341 loads the necessary modules from the initial root file-system.
345 creates and populates the root file system.
346 (At this stage the normal root file system does not have to be a
347 completed system yet.)
352 .IR /proc/sys/kernel/real-root-dev ,
355 the normal root file system and any other file
356 systems it has mounted, and then terminates.
358 The kernel then mounts the normal root file system.
360 Now that the file system is accessible and intact,
361 the boot loader can be installed.
363 The boot loader is configured to load into
365 a file system with the set of modules that was used to bring up the system.
368 can be modified, then unmounted, and finally, the image is written from
372 The system is now bootable and additional installation tasks can be
377 in the above is to reuse the configuration data during normal system operation
378 without requiring initial kernel selection, a large generic kernel or,
379 recompiling the kernel.
381 A second scenario is for installations where Linux runs on systems with
382 different hardware configurations in a single administrative network.
383 In such cases, it may be desirable to use only a small set of kernels
384 (ideally only one) and to keep the system-specific part of configuration
385 information as small as possible.
386 In this case, create a common file
387 with all needed modules.
390 file or a file executed by
394 A third scenario is more convenient recovery disks.
395 Because information like the location of the root file-system
396 partition is not needed at boot time, the system loaded from
398 can use a dialog and/or auto-detection followed by a
399 possible sanity check.
401 Last but not least, Linux distributions on CD-ROM may use
403 for easy installation from the CD-ROM.
404 The distribution can use
408 from CD-ROM without the need of any floppies.
409 The distribution could also use a
411 boot floppy and then bootstrap a bigger RAM disk via
430 With the current kernel, any file systems that remain mounted when
436 continue to be accessible.
439 entries are not updated.
441 With the current kernel, if directory
447 be fully unmounted if
449 is used by any process or has any file-system mounted on it.
454 fully unmounted, then
456 will remain in memory.
460 should not depend on the behavior give in the above notes.
461 The behavior may change in future versions of the Linux kernel.
466 .\" The kernel code for device
468 .\" was written by Werner Almesberger <almesber@lrc.epfl.ch> and
469 .\" Hans Lermen <lermen@elserv.ffm.fgan.de>.
472 .\" was added to the baseline Linux kernel in development version 1.3.73.
480 The documentation file
482 in the kernel source package, the LILO documentation,
483 the LOADLIN documentation, the SYSLINUX documentation.