1 .\" This man-page is Copyright (C) 1997 John S. Kallal
3 .\" %%%LICENSE_START(VERBATIM)
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.
25 .\" If the you wish to distribute versions of this work under other
26 .\" conditions than the above, please contact the author(s) at the following
30 .\" email: <kallal@voicenet.com>
31 .\" mail: 518 Kerfoot Farm RD, Wilmington, DE 19803-2444, USA
32 .\" phone: (302)654-5478
34 .\" $Id: initrd.4,v 0.9 1997/11/07 05:05:32 kallal Exp kallal $
35 .TH INITRD 4 2021-03-22 "Linux" "Linux Programmer's Manual"
37 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:
53 mknod \-m 400 /dev/initrd b 1 250
54 chown root:disk /dev/initrd
58 Also, support for both "RAM disk" and "Initial RAM disk"
60 .BR CONFIG_BLK_DEV_RAM=y
62 .BR CONFIG_BLK_DEV_INITRD=y )
63 must be compiled directly into the Linux kernel to use
67 the RAM disk driver cannot be loaded as a module.
74 is a read-only block device.
75 This device is a RAM disk that is initialized (e.g., loaded)
76 by the boot loader before the kernel is started.
77 The kernel then can use
79 contents for a two-phase system boot-up.
81 In the first boot-up phase, the kernel starts up
82 and mounts an initial root filesystem from the contents of
84 (e.g., RAM disk initialized by the boot loader).
85 In the second phase, additional drivers or other modules
86 are loaded from the initial root device's contents.
87 After loading the additional modules, a new root filesystem
88 (i.e., the normal root filesystem) is mounted from a
96 the system boots as follows:
98 The boot loader loads the kernel program and
100 contents into memory.
103 the kernel uncompresses and copies the contents of the device
107 and then frees the memory used by
110 The kernel then read-write mounts the device
112 as the initial root filesystem.
114 If the indicated normal root filesystem is also the initial
115 root filesystem (e.g.,
117 then the kernel skips to the last step for the usual boot sequence.
119 If the executable file
121 is present in the initial root filesystem,
123 is executed with UID 0.
126 must have executable permission.
129 can be any valid executable, including a shell script.)
133 is not executed or when
135 terminates, the normal root filesystem is mounted.
138 exits with any filesystems mounted on the initial root
139 filesystem, then the behavior of the kernel is
141 See the NOTES section for the current kernel behavior.)
143 If the normal root filesystem has a directory
151 Otherwise, if the directory
153 does not exist, the device
161 is not unmounted and therefore processes can remain running from
165 does not exist on the normal root filesystem
166 and any processes remain running from
170 exits, the behavior of the kernel is
172 See the NOTES section for the current kernel behavior.)
174 The usual boot sequence (e.g., invocation of
176 is performed on the normal root filesystem.
181 The following boot loader options, when used with
183 affect the kernel's boot-up operation:
185 .BI initrd= "filename"
186 Specifies the file to load as the contents of
190 this is a command-line option.
193 you have to use this command in the
196 .IR /etc/lilo.config .
197 The filename specified with this
198 option will typically be a gzipped filesystem image.
201 This boot option disables the two-phase boot-up operation.
202 The kernel performs the usual boot sequence as if
205 With this option, any contents of
207 loaded into memory by the boot loader contents are preserved.
208 This option permits the contents of
210 to be any data and need not be limited to a filesystem image.
213 is read-only and can be read only one time after system startup.
215 .BI root= "device-name"
216 Specifies the device to be used as the normal root filesystem.
219 this is a command-line option.
222 this is a boot time option or
223 can be used as an option line in the
226 .IR /etc/lilo.config .
227 The device specified by this option must be a mountable
228 device having a suitable root filesystem.
232 .SS Changing the normal root filesystem
234 the kernel's settings
235 (e.g., set in the kernel file with
237 or compiled into the kernel file),
238 or the boot loader option setting
239 is used for the normal root filesystems.
240 For an NFS-mounted normal root filesystem, one has to use the
244 boot options to give the NFS settings.
245 For more information on NFS-mounted root see the kernel documentation file
246 .I Documentation/filesystems/nfs/nfsroot.txt
247 .\" commit dc7a08166f3a5f23e79e839a8a88849bd3397c32
249 .I Documentation/filesystems/nfsroot.txt
250 before Linux 2.6.33).
251 For more information on setting the root filesystem see also the
257 It is also possible for the
259 executable to change the normal root device.
262 to change the normal root device,
268 changes the normal root device by writing into the proc files
269 .IR /proc/sys/kernel/real\-root\-dev ,
270 .IR /proc/sys/kernel/nfs\-root\-name ,
272 .IR /proc/sys/kernel/nfs\-root\-addrs .
273 For a physical root device, the root device is changed by having
275 write the new root filesystem device number into
276 .IR /proc/sys/kernel/real\-root\-dev .
277 For an NFS root filesystem, the root device is changed by having
279 write the NFS setting into files
280 .IR /proc/sys/kernel/nfs\-root\-name
282 .I /proc/sys/kernel/nfs\-root\-addrs
283 and then writing 0xff (e.g., the pseudo-NFS-device number) into file
284 .IR /proc/sys/kernel/real\-root\-dev .
285 For example, the following shell command line would change
286 the normal root device to
291 echo 0x365 >/proc/sys/kernel/real\-root\-dev
295 For an NFS example, the following shell command lines would change the
296 normal root device to the NFS directory
298 on a local networked NFS server with IP number 193.8.232.7 for a system with
299 IP number 193.8.232.2 and named "idefix":
303 echo /var/nfsroot >/proc/sys/kernel/nfs\-root\-name
304 echo 193.8.232.2:193.8.232.7::255.255.255.0:idefix \e
305 >/proc/sys/kernel/nfs\-root\-addrs
306 echo 255 >/proc/sys/kernel/real\-root\-dev
312 .I /proc/sys/kernel/real\-root\-dev
313 to change the root filesystem is obsolete.
314 See the Linux kernel source file
315 .I Documentation/admin\-guide/initrd.rst
316 .\" commit 9d85025b0418163fae079c9ba8f8445212de8568
318 .I Documentation/initrd.txt
324 for information on the modern method of changing the root filesystem.
325 .\" FIXME . Should this manual page describe the pivot_root mechanism?
330 The main motivation for implementing
332 was to allow for modular kernel configuration at system installation.
334 A possible system installation scenario is as follows:
336 The loader program boots from floppy or other media with a minimal kernel
340 and the ext2 filesystem) and loads
342 with a gzipped version of the initial filesystem.
346 determines what is needed to (1) mount the normal root filesystem
347 (i.e., device type, device drivers, filesystem) and (2) the
348 distribution media (e.g., CD-ROM, network, tape, ...).
349 This can be done by asking the user, by auto-probing,
350 or by using a hybrid approach.
354 loads the necessary modules from the initial root filesystem.
358 creates and populates the root filesystem.
359 (At this stage the normal root filesystem does not have to be a
360 completed system yet.)
365 .IR /proc/sys/kernel/real\-root\-dev ,
368 the normal root filesystem and any other filesystems
369 it has mounted, and then terminates.
371 The kernel then mounts the normal root filesystem.
373 Now that the filesystem is accessible and intact,
374 the boot loader can be installed.
376 The boot loader is configured to load into
378 a filesystem with the set of modules that was used to bring up the system.
381 can be modified, then unmounted, and finally, the image is written from
385 The system is now bootable and additional installation tasks can be
390 in the above is to reuse the configuration data during normal system operation
391 without requiring initial kernel selection, a large generic kernel or,
392 recompiling the kernel.
394 A second scenario is for installations where Linux runs on systems with
395 different hardware configurations in a single administrative network.
396 In such cases, it may be desirable to use only a small set of kernels
397 (ideally only one) and to keep the system-specific part of configuration
398 information as small as possible.
399 In this case, create a common file
400 with all needed modules.
403 file or a file executed by
407 A third scenario is more convenient recovery disks.
408 Because information like the location of the root filesystem
409 partition is not needed at boot time, the system loaded from
411 can use a dialog and/or auto-detection followed by a
412 possible sanity check.
414 Last but not least, Linux distributions on CD-ROM may use
416 for easy installation from the CD-ROM.
417 The distribution can use
421 from CD-ROM without the need of any floppies.
422 The distribution could also use a
424 boot floppy and then bootstrap a bigger RAM disk via
443 With the current kernel, any filesystems that remain mounted when
449 continue to be accessible.
452 entries are not updated.
454 With the current kernel, if directory
460 be fully unmounted if
462 is used by any process or has any filesystem mounted on it.
467 fully unmounted, then
469 will remain in memory.
473 should not depend on the behavior given in the above notes.
474 The behavior may change in future versions of the Linux kernel.
479 .\" The kernel code for device
481 .\" was written by Werner Almesberger <almesber@lrc.epfl.ch> and
482 .\" Hans Lermen <lermen@elserv.ffm.fgan.de>.
485 .\" was added to the baseline Linux kernel in development version 1.3.73.
493 .I Documentation/admin\-guide/initrd.rst
494 .\" commit 9d85025b0418163fae079c9ba8f8445212de8568
496 .I Documentation/initrd.txt
498 in the Linux kernel source tree, the LILO documentation,
499 the LOADLIN documentation, the SYSLINUX documentation