Advantages of NFS Root for SBCs
Single Board Computers typically have limited onboard storage - there are size, performance, endurance and power limitations. Moreover SBCs are not powerful enough to run modern filesystems like ZFS, btrfs that offer COW, snapshot, compression and other advanced features. Mounting the SBC root file system over NFS solves all these limitations.
See rpi-nfs-root for migrating an RPi to NFS root.
Advantages
Booting SBCs from the network has the following advantages:
- SBC becomes stateless, and can boot any flavor of Linux simply by adjusting the network root fs location. RPi can run different flavors of Ubuntu, Debian, etc and can swap between them easily.
- Resetting the SBC between different use cases or experiments is trivially easy - just change the NFS root mount point and the SBC will run an entirely different userland. The NFS root can be changed on the server side for maximum ease.
- SD card or eMMC wear is eliminated.
- Disk capacity is not limited by the physical SD card or eMMC, any amount of storage can be provisioned on the NFS server and published to the SBC.
- Performance of NFS over 1GigE is much faster than SD card or eMMC. An RPi 4B+ can saturate a 1GigE network connection with just the default setup.
- On the NFS server, modern filesystems like btrfs, ZFS, etc can be used provide compression, snapshots, etc. This can be used to test changes on the SBC and rollback if required. Mounting subvolumes and paths has some caveats (use of fsid), refer to the official docs.
- No need to SCP files to the SBC, just copy the files to the NFS server and files are immediately available on the SBC.
Disadvantages
- Complexity - traditional dhcp, bootp and tftp booting is a fragile process to setup and maintain. Avoid this complexity by booting the kernel from local storage and using the Linux kernel command line parameters and set the root to NFS.