How to Change NFS block size for NFS based RFS

Summary

Many of our boards experience NFS timeouts when mounting the RFS over NFS, but this can often be solved by simply changing the NFS block size.

Prerequisites

NFS mounted RFS which is experiencing nfs timeouts similar to the one shown below.

nfs: server 10.0.0.2 not responding, still trying

Procedure

Add the 'nfsroot' option to your kernel command line as per the documentaion below and change the block size to something reasonable like 1024 (1024 is no longer the default, even if it says it is).

nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>]

  If the `nfsroot' parameter is NOT given on the command line, the default
  "/tftpboot/%s" will be used.

  <server-ip>    Specifies the IP address of the NFS server. If this field
        is not given, the default address as determined by the
        `ip' variable (see below) is used. One use of this
        parameter is for example to allow using different servers
        for RARP and NFS. Usually you can leave this blank.

  <root-dir>    Name of the directory on the server to mount as root. If
        there is a "%s" token in the string, the token will be
        replaced by the ASCII-representation of the client's IP
        address.

  <nfs-options>    Standard NFS options. All options are separated by commas.
        If the options field is not given, the following defaults
        will be used:
            port        = as given by server portmap daemon
            rsize        = 1024
            wsize        = 1024
            timeo        = 7
            retrans        = 3
            acregmin    = 3
            acregmax    = 60
            acdirmin    = 30
            acdirmax    = 60
            flags        = hard, nointr, noposix, cto, ac

Examples

On the i.MX31PDK the kernel command line changes from

noinitrd console=ttymxc0,115200 root=/dev/nfs rw ip=dhcp

to
noinitrd console=ttymxc0,115200 root=/dev/nfs rw ip=dhcp nfsroot=10.0.0.2:/local/rfs/imx31pdk-1/rfs,rzise=1024,wsize=1024

Additional Resources

NFS Root

Files