Booting a Raspberry Pi from SD card, root filesystem is NFS

Other documentation has recommended the following line

dwc_otg.lpm_enable=0 console=tty1 root=/dev/nfs nfsroot=,tcp,rw,vers=3 ip=dhcp rootfstype=nfs elevator=deadline rootwait

This kernel panicked for me each time due to the rootfstype=nfs, so after some digging, I used:

 console=tty1 root=/dev/nfs nfsroot=,vers=3 rw ip=dhcp rootwait elevator=deadline

On the NFS server, /etc/exports contains:


/data/raspbian_nfs/2020_06 is populated using:

# mount /mnt
# rsync -Phax --numeric-ids / /mnt/data/raspbian_nfs/2020_06

The /etc/dhcp/dhcpd.conf is too complicated to document fully here, but this section is relevant:

subnet netmask {
  server-name "";
  option broadcast-address;
  option subnet-mask;
  option routers;

I then flash an SD card as normal, copy the content across to the /data/raspbian_nfs/2020_06 directory, remove the boot from that directory.

The /etc/fstab on the Raspberry Pi and in /data/raspbian_nfs/2020_06/etc/fstab should look as follows:

proc            /proc           proc    defaults          0       0
LABEL=boot  /boot           vfat    defaults          0       2 / nfs defaults 0 0

The partition /dev/mmcblk0p2 can then be removed from the SD card, using fdisk once the Pi boots