Based on kernel version 2.6.32. Page generated on 2009-12-11 16:22 EST.

1Mounting the root filesystem via NFS (nfsroot)
2===============================================
34Written 1996 by Gero Kuhlmann <gero[AT]gkminix.han[DOT]de>
5Updated 1997 by Martin Mares <mj[AT]atrey.karlin.mff.cuni[DOT]cz>
6Updated 2006 by Nico Schottelius <nico-kernel-nfsroot[AT]schottelius[DOT]org>
7Updated 2006 by Horms <horms[AT]verge.net[DOT]au>
891011In order to use a diskless system, such as an X-terminal or printer server
12for example, it is necessary for the root filesystem to be present on a
13non-disk device. This may be an initramfs (see Documentation/filesystems/
14ramfs-rootfs-initramfs.txt), a ramdisk (see Documentation/initrd.txt) or a
15filesystem mounted via NFS. The following text describes on how to use NFS
16for the root filesystem. For the rest of this text 'client' means the
17diskless system, and 'server' means the NFS server.
18192021221.) Enabling nfsroot capabilities
23 -----------------------------
2425In order to use nfsroot, NFS client support needs to be selected as
26built-in during configuration. Once this has been selected, the nfsroot
27option will become available, which should also be selected.
2829In the networking options, kernel level autoconfiguration can be selected,
30along with the types of autoconfiguration to support. Selecting all of
31DHCP, BOOTP and RARP is safe.
32333435362.) Kernel command line
37 -------------------
3839When the kernel has been loaded by a boot loader (see below) it needs to be
40told what root fs device to use. And in the case of nfsroot, where to find
41both the server and the name of the directory on the server to mount as root.
42This can be established using the following kernel command line parameters:
434445root=/dev/nfs
4647 This is necessary to enable the pseudo-NFS-device. Note that it's not a
48 real device but just a synonym to tell the kernel to use NFS instead of
49 a real device.
505152nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>]
5354 If the `nfsroot' parameter is NOT given on the command line,
55 the default "/tftpboot/%s" will be used.
5657 <server-ip> Specifies the IP address of the NFS server.
58 The default address is determined by the `ip' parameter
59 (see below). This parameter allows the use of different
60 servers for IP autoconfiguration and NFS.
6162 <root-dir> Name of the directory on the server to mount as root.
63 If there is a "%s" token in the string, it will be
64 replaced by the ASCII-representation of the client's
65 IP address.
6667 <nfs-options> Standard NFS options. All options are separated by commas.
68 The following defaults are used:
69 port = as given by server portmap daemon
70 rsize = 4096
71 wsize = 4096
72 timeo = 7
73 retrans = 3
74 acregmin = 3
75 acregmax = 60
76 acdirmin = 30
77 acdirmax = 60
78 flags = hard, nointr, noposix, cto, ac
798081ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>
8283 This parameter tells the kernel how to configure IP addresses of devices
84 and also how to set up the IP routing table. It was originally called
85 `nfsaddrs', but now the boot-time IP configuration works independently of
86 NFS, so it was renamed to `ip' and the old name remained as an alias for
87 compatibility reasons.
8889 If this parameter is missing from the kernel command line, all fields are
90 assumed to be empty, and the defaults mentioned below apply. In general
91 this means that the kernel tries to configure everything using
92 autoconfiguration.
9394 The <autoconf> parameter can appear alone as the value to the `ip'
95 parameter (without all the ':' characters before). If the value is
96 "ip=off" or "ip=none", no autoconfiguration will take place, otherwise
97 autoconfiguration will take place. The most common way to use this
98 is "ip=dhcp".
99100 <client-ip> IP address of the client.
101102 Default: Determined using autoconfiguration.
103104 <server-ip> IP address of the NFS server. If RARP is used to determine
105 the client address and this parameter is NOT empty only
106 replies from the specified server are accepted.
107108 Only required for NFS root. That is autoconfiguration
109 will not be triggered if it is missing and NFS root is not
110 in operation.
111112 Default: Determined using autoconfiguration.
113 The address of the autoconfiguration server is used.
114115 <gw-ip> IP address of a gateway if the server is on a different subnet.
116117 Default: Determined using autoconfiguration.
118119 <netmask> Netmask for local network interface. If unspecified
120 the netmask is derived from the client IP address assuming
121 classful addressing.
122123 Default: Determined using autoconfiguration.
124125 <hostname> Name of the client. May be supplied by autoconfiguration,
126 but its absence will not trigger autoconfiguration.
127128 Default: Client IP address is used in ASCII notation.
129130 <device> Name of network device to use.
131132 Default: If the host only has one device, it is used.
133 Otherwise the device is determined using
134 autoconfiguration. This is done by sending
135 autoconfiguration requests out of all devices,
136 and using the device that received the first reply.
137138 <autoconf> Method to use for autoconfiguration. In the case of options
139 which specify multiple autoconfiguration protocols,
140 requests are sent using all protocols, and the first one
141 to reply is used.
142143 Only autoconfiguration protocols that have been compiled
144 into the kernel will be used, regardless of the value of
145 this option.
146147 off or none: don't use autoconfiguration
148 (do static IP assignment instead)
149 on or any: use any protocol available in the kernel
150 (default)
151 dhcp: use DHCP
152 bootp: use BOOTP
153 rarp: use RARP
154 both: use both BOOTP and RARP but not DHCP
155 (old option kept for backwards compatibility)
156157 Default: any
1581591601611623.) Boot Loader
163 ----------
164165To get the kernel into memory different approaches can be used.
166They depend on various facilities being available:
1671681693.1) Booting from a floppy using syslinux
170171 When building kernels, an easy way to create a boot floppy that uses
172 syslinux is to use the zdisk or bzdisk make targets which use zimage
173 and bzimage images respectively. Both targets accept the
174 FDARGS parameter which can be used to set the kernel command line.
175176 e.g.
177 make bzdisk FDARGS="root=/dev/nfs"
178179 Note that the user running this command will need to have
180 access to the floppy drive device, /dev/fd0
181182 For more information on syslinux, including how to create bootdisks
183 for prebuilt kernels, see http://syslinux.zytor.com/184185 N.B: Previously it was possible to write a kernel directly to
186 a floppy using dd, configure the boot device using rdev, and
187 boot using the resulting floppy. Linux no longer supports this
188 method of booting.
1891903.2) Booting from a cdrom using isolinux
191192 When building kernels, an easy way to create a bootable cdrom that
193 uses isolinux is to use the isoimage target which uses a bzimage
194 image. Like zdisk and bzdisk, this target accepts the FDARGS
195 parameter which can be used to set the kernel command line.
196197 e.g.
198 make isoimage FDARGS="root=/dev/nfs"
199200 The resulting iso image will be arch/<ARCH>/boot/image.iso
201 This can be written to a cdrom using a variety of tools including
202 cdrecord.
203204 e.g.
205 cdrecord dev=ATAPI:1,0,0 arch/i386/boot/image.iso
206207 For more information on isolinux, including how to create bootdisks
208 for prebuilt kernels, see http://syslinux.zytor.com/2092103.2) Using LILO
211 When using LILO all the necessary command line parameters may be
212 specified using the 'append=' directive in the LILO configuration
213 file.
214215 However, to use the 'root=' directive you also need to create
216 a dummy root device, which may be removed after LILO is run.
217218 mknod /dev/boot255 c 0 255
219220 For information on configuring LILO, please refer to its documentation.
2212223.3) Using GRUB
223 When using GRUB, kernel parameter are simply appended after the kernel
224 specification: kernel <kernel> <parameters>
2252263.4) Using loadlin
227 loadlin may be used to boot Linux from a DOS command prompt without
228 requiring a local hard disk to mount as root. This has not been
229 thoroughly tested by the authors of this document, but in general
230 it should be possible configure the kernel command line similarly
231 to the configuration of LILO.
232233 Please refer to the loadlin documentation for further information.
2342353.5) Using a boot ROM
236 This is probably the most elegant way of booting a diskless client.
237 With a boot ROM the kernel is loaded using the TFTP protocol. The
238 authors of this document are not aware of any no commercial boot
239 ROMs that support booting Linux over the network. However, there
240 are two free implementations of a boot ROM, netboot-nfs and
241 etherboot, both of which are available on sunsite.unc.edu, and both
242 of which contain everything you need to boot a diskless Linux client.
2432443.6) Using pxelinux
245 Pxelinux may be used to boot linux using the PXE boot loader
246 which is present on many modern network cards.
247248 When using pxelinux, the kernel image is specified using
249 "kernel <relative-path-below /tftpboot>". The nfsroot parameters
250 are passed to the kernel by adding them to the "append" line.
251 It is common to use serial console in conjunction with pxeliunx,
252 see Documentation/serial-console.txt for more information.
253254 For more information on isolinux, including how to create bootdisks
255 for prebuilt kernels, see http://syslinux.zytor.com/2562572582592604.) Credits
261 -------
262263 The nfsroot code in the kernel and the RARP support have been written
264 by Gero Kuhlmann <gero[AT]gkminix.han.de>[DOT]
265266 The rest of the IP layer autoconfiguration code has been written
267 by Martin Mares <mj[AT]atrey.karlin.mff.cuni.cz>[DOT]
268269 In order to write the initial version of nfsroot I would like to thank
270 Jens-Uwe Mager <jum[AT]anubis.han.de> for his help[DOT]