Pages

2010-09-07

Linux: Mount Root File System on NFS

To enable your embedded system to mount its root file system via NFS we must configure our target's kernel for NFS support. There is also a configuration option to enable root mounting of an NFS remote directory.

To statically configure our target's IP address, our kernel command line might look like this:

console=ttyS0,115200                                      ip=192.168.1.139:192.168.1.1:192.168.1.1:255.255.255.0:embedded_host:eth0:off     nfsroot=192.168.1.1:/home/me/my_remote_folder root=/dev/nfs rw
Where:

 ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<PROTO>
 
Here, client-ip is the target's IP address; server-ip is the address of the NFS server; gw-ip is the gateway (router), in case the server-ip is on a different subnet; and netmask defines the class of IP addressing. hostname is a string that is passed as the target hostname; device is the Linux device name, such as eth0; and PROTO defines the protocol used to obtain initial IP parameters.

For a sample example using DHCP protocol:

console=ttyS0,115200 root=/dev/nfs rw ip=dhcp
   nfsroot=192.168.1.9://home/me/my_remote_folder

No comments:

Post a Comment