For now I’m putting this in general but might write a tutorial for network booting RPi4s and keeping their full filesystem on a NFS share.
Overall the instructions are the same as the others found on the Internet for network booting a RPi4. The only gotcha was that DietPi didn’t seem happy to get the network stack going (hung during bootup with messages I don’t have handy). I disabled the interface in DietPi and that seemed to make everything work - the system actually boots with the interface working. I assume this is something to do with “Oh, it’s already here!”.
Rough instructions for now:
-
Update the bootroms on your Rpi and set the configuration to boot of the network. This requires a bootable existing RPi OS with a couple utilities. While you are there get the MAC address of each system and write it down. DietPi was fine for this.
-
Setup a TFTP server, make a directory in the root for each MAC address with the format dc-a6-32-01-36-c2 and put the contents of /boot from a working OS image into it.
-
Setup a NFS server and put a copy of both boot and root into a directory named something unique. It might be good to use the MAC addresses?
-
Setup your DHCP server to include necessary PXE boot options and point them at the server from step 2. Instructions are elsewhere on the Internet - this can be tricky - having a display on the RPi when it boots can help diagnose problems.
-
Modify the
cmdline.txt
on the server you’re booting from to reflect that root is on NFS, meaning the server from step 3. Something like:
nfsrootdebug usb-storage.quirks=152d:0578:u root=/dev/nfs nfsroot=10.0.0.20:/data/nfs/Rpi1,tcp,rw,v3 ip=dhcp rootfstype=nfs rootwait fsck.repair=yes net.ifnames=0 logo.nologo console=tty1 cgroup_enable=memory
- Modify the /etc/fstab on the root share (again on the server) to reflect that you’re using NFS filesystems. Something like:
#----------------------------------------------------------------
# PHYSICAL DRIVES
#----------------------------------------------------------------
#PARTUUID=0baaf667-02 / ext4 noatime,lazytime,rw 0 1
#PARTUUID=0baaf667-01 /boot vfat noatime,lazytime,rw 0 2
10.0.0.20:/data/nfs/dc-a6-32-1c-42-94 /boot nfs defaults 0 2
10.0.0.20:/data/nfs/Rpi1 / nfs defaults,noatime 0 1
I’ll be moving one of my Pi3b+ over to full network boot/root in the next couple weeks.