NFS: Cannot properly export a mount point
Alpine is set up as a local file server, using NFS. I am trying to export a mounted device (a drive attached to the system).
Attempting to mount the exported directory on a client just makes the client stuck executing the
I am running Version 3.13.0 on a Raspberry Pi 4 (installed using this guide from the wiki).
/etc/exports looks like this:
/export *(fsid=root,sync,crossmnt,nohide,no_subtree_check) # regular directory that can be mounted correctly by client /export/test *(sync,crossmnt,no_subtree_check) # mount point of /dev/sdb1; cannot be mounted by client /export/drive *(sync,crossmnt,no_subtree_check)
These are the options set in
/etc/conf.d/nfs (other variables are empty):
NFS_NEEDED_SERVICES="rpc.idmapd" OPTS_RPC_NFSD="8 -N 2 -N 3 -V 4 -V 4.1 -V 4.2 --debug --syslog" OPTS_RPC_MOUNTD="--debug all" EXPORTFS_TIMEOUT=30
This is what is logged to
/var/log/messages when attempting to mount
/drive, especially the second line seems troublesome):
rpc.mountd: nfsd_fh: inbuf '* 6 \x5fad7737000000000000000000000000' rpc.mountd: nfsd_fh: found 0 path (null)
I also checked
nfsstat, where everything looks normal: zero badcalls, badclnt, badauth.
nfsstat -m on the client did not print anything (while beingn stuck mounting
/drive) — it gave a result with
Mounting worked correctly both for
/export, but mounting
/export/drive just froze the prompt: No error message, nothing. I waited for several minutes.
/export, trying to view either the content of
/export or the
drive subdirectory via
ls also froze the prompt, as described above. Listing the content of
/export/test worked, though.
I did not specify any options when mounting:
mount 10.0.0.20:/drive /mnt/drive
exportfs -arv doesn’t report any errors.
What I’ve tried
Different File Systems
I tried ExFat and btrfs. I made sure both work and can be accessed on the server.
Using a Bind Mount
I mounted a regular directory on the root file system at
mount --bind /random/dir /export/drive.
This lead to the same result as exporting a mounted device, but with different log messages:
rpc.mountd: nfsd_export: inbuf '* /export/drive' rpc.mountd: nfsd_export: found 0x7f8826f550 path /export/drive rpc.mountd: nfsd_fh: inbuf '* 1 \x00000000' rpc.mountd: nfsd_fh: found 0x7f9f975040 path /export
I tried NFS 3, 4, 4.1 and (the default) 4.2; all lead to the same result.
I tried running
rcpdebug -m nfsd -s all (as suggested by this short guide) resulting in this error:
/proc/sys/sunrpc/nfsd_debug: No such file or directory
I also tried adding the
mp option, which should only export the specified path if is a mount point. I tried it for both
/test has successfully been prevented; mounting
/drive was not different from before.
Mounting on itself
I tried mounting the exported
mount localhost:/drive /mnt/drive, with no success.
Using Gentoo and Raspberry OS
Finally, I replicated the setup on the client machine (running Gentoo), turning it into the server: Mounting of
/drive on Alpine and Gentoo worked.
I also tested the same setup with Raspberry Pi OS Lite (2021-01-11), where it worked without any problems as well.
It seems it is a problem with Alpine.