[Hampshire] Using NFS root with raspberry pi.

Top Page

Reply to this message
Author: Tom Gamble via Hampshire
Date:  
To: hampshire
CC: Tom Gamble
Subject: [Hampshire] Using NFS root with raspberry pi.
Hi,

On my Raspberry Pis I’ve had a few issues with SD Cards failing so thought there would be some mileage in using an NFS root. So if an SD card fails I can just pop a new card in and my root fs will still be good.

The research I’ve done more or less says

On the NFS Server set up the directory that will be your nfs root fs copy the contents of the rootfs on the SD Card to the directory.
edit the the /etc/fstab to reflect the nfsmount.

Change the /boot/cmdline.txt from the default to

console=serial0,115200 console=tty1 root=/dev/nfs nfsroot=NFSHOSTIP:/path/to/nfsroot,tcp rw vers=3 ip=dhcp rootfstype=nfs
elevator=deadline rootwait

Now when you boot from that SDCard it should have too on the NFS filesystem.

When I tried it the pi hung for a while and then spat out the error

VFS: Unable to mount root fs via NFS

followed by a kernel panic.

So to try and understand what i had done wrongly I put the codlin.txt back to default and booted using the the rootfs on the SD card.
I was able to mount the NFSroot on /media/nfsroot using the command

# mount -t nfs NFSHOSTIP://path/to/nfsroot /media/nfsroot

I also added the following line to /etc/fstab

NFSHOSTIP:/path/to/nfsroot /media/nfsroot nfs defaults 0 0

that allowed the NFSroot to mount using mount -a

rebooting the Pi also resulted in the NFSroot getting mounted on /media/nfsroot

So I’m pretty sure that my nfs configuration is good.

When booting from the the default cmdline.txt and mounting the NFS filesystem

# grep rpc.mountd /var/log/syslog

does not give any messages.

However, attempting to boot NFSroot the message

Oct 10 12:37:06 NFSHOST rpc.mountd[628]: authenticated mount request from CLIENTIP for /path/to/nfsroot (/path/to/nfsroot)

(Obviously I have anonymised the hostnames and ipaddresses.)

Further research suggested that the solution that message was to add “no_root_squash” as one of the options to the /etc/exports line but that is there anyway.

I’ve mostly worked with the Red Hat, Fedora and Centos distros so my Debian knowledge a bit limited by comparison also even though I’ve used NFS a fair bit I’ve never really had any problems with it till now.

Can anyone give me some pointers as to where I can look for more information on what is going wrong.

Oh I nearly forgot. I’m running Bullseye on both the NFS server and the Pi and they both have the same nfs versions.



Cheers.
Tom.


--
Please post to: Hampshire@???
Web Interface: https://mailman.lug.org.uk/mailman/listinfo/hampshire
LUG URL: http://www.hantslug.org.uk
--------------------------------------------------------------