I have an NFS server on a Pi 4 which works rather well except I'm often getting "Stale file handle" on the client after rebooting the Pi. That is while the client has the share mounted, the Pi reboots, upon it being booted the client spits out the error when trying a file operation like ls. What's causing this and how can I fix it?

1 Answer 1


The problem is that the filesystem that's exported by NFS isn't always ready when NFS starts. In this particular case, there's an external disk that is asynchronously mounted on boot and sometimes NFS starts before that happens. The result is that NFS can't export the filesystem.

One good solution is to use systemd to create a dependency between NFS and the filesystem. There are multiple ways to do this but perhaps the simplest is:

  1. Open /etc/fstab and
  2. Add the option x-systemd.before=nfs-server.service to the mount options for the filesystem

Once complete, nfs-server.service will only be started after the filesystem is mounted and will therefore successfully export it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .