NFS mounting problems in Rocky Linux 9.5

to state up front: I am NOT using kerberos or anything else of that sort.

I am bringing up a new NAS (a Synology DS223j) and want to use NFS rather than cifs/SMB for nightly backups (because I think the problems I was having using cifs may be due to the huge number of hard links that rsnapshot uses)

So far I have, after considerable head-banging (never having used NFS on Linux, but on other Unixes decades ago) I have managed to get the backup volume (on the Synology box) working and a command-line mount on Linux, and backups now appear to run flawlessly.

(previously, for years I have used one or another inexpensive 2-drive ā€œRaid boxesā€ that connected via USB, so I didn’t have to worry about network protocols.)

My issue is this: If I use ā€œ-t nfsā€ in the mount command I get an error:

$ sudo mount -vvv -t nfs -o defaults,x-systemd.automount,auto,users,exec FcsHome-Backup3:/volume1/backup /mnt/backup
mount.nfs: timeout set for Tue Apr 22 14:06:04 2025
mount.nfs: trying text-based options ā€˜vers=4.2,addr=192.168.2.148,clientaddr=192.168.2.12’
mount.nfs: mount(2): Protocol not supported
mount.nfs: trying text-based options ā€˜vers=4,minorversion=1,addr=192.168.2.148,clientaddr=192.168.2.12’

I’m referring to the ā€œProtocol not supportedā€ line above.

if I modify the commandline, i.e., by removing ā€œ-t nfsā€ it mounts fine.

I can’t find any docs that would explain that error.

if I build (what I think is) an equivalent entry in /etc/fstab:

//FcsHome-Backup3/volume1/backup /mnt/backup nfs defaults,x-systemd.automount,x-systemd.idle-timeout=ā€œ15min 0sā€,auto,users,exec 0 2

it also fails in the same way. I’ve tried nfs, nfs3, nfs4, nfsv4, nfsv4.1 and all of them elicit the warning about unsupported protocol.

I’m willing to omit that from the fstab file, but I can’t find out what the proper syntax is for doing that.

Can anyone here suggest how to either give an acceptable fstype in the commandline (and fstab) or how to omit it from fstab (without screwing up its knowledge of which field in its entry is which?

Thanks in advance!

Fred

This is what I use with my qnap fileserver:

fileserver:/homes/ /mnt/fileserver nfs nfsvers=3 0 0

If you still had the -vvv, then did mount tell what it tried/did?

What does findmnt show about the ā€œsuccessfully mountedā€ volume?
(It should show fstype and options.)

You have enabled NFS on the Synology? Does it have any options for the NFS versions, etc?

The first field should be FcsHome-Backup3:/volume1/backup, just like the ā€˜device’ in the mount command.


man 8 mount writes:

If no -t option is given, or if the auto type is specified, mount will try to guess the desired type. mount uses the libblkid(3) library for guessing the filesystem type; if that does not turn up anything that looks familiar, mount will try to read the file /etc/filesystems, or, if that does not exist, /proc/filesystems. All of the filesystem types listed there will be tried, except for those that are labeled ā€œnodevā€ (e.g. devpts, proc and nfs). If /etc/filesystems ends in a line with a single *, mount will read /proc/filesystems afterwards. While trying, all filesystem types will be mounted with the mount option silent.

I.e. you succeed with -t auto, and findmnt -u /mnt/backup should show actual fstype, etc.

If you still had the -vvv, then did mount tell what it tried/did?

What does findmnt show about the ā€œsuccessfully mountedā€ volume?
(It should show fstype and options.)

You have enabled NFS on the Synology? Does it have any options for the NFS versions, etc?

yes, but not why I got the error.

findmnt shows it is nfs4 as well as the other options applied.

yes, NFS is enabled on Synology. Digging through some Synology help pages indicated I should have allowed ports above 1024, and correcting that doesn’t fix the error but it does allow it to mount and lets me transfer files. (the first backup was over 200 G, taking about 53 minutes, and everything looks good, no errors reported in /var/log/rsnapshot–I have logging to that file set to the most verbose option.).

The first field should be FcsHome-Backup3:/volume1/backup, just like the ā€˜device’ in the mount command.
Yes, I’ve fixed that.

Subsequent perusal of various nfs-related subjects on the web informs me that the fstype error comes from the server. Haven’t figured that one out, quite yet, but it mounts from the commandline and I’m working on fstab.

I also really want it to automount, so I’m working on that too–it didn’t automount on an early try yesterday, so either that option doesn’t work for NFS volumes, or else I had something else wrong (entirely possible, that!).

Thanks, guys, for all the suggestions!

Fred

Automount won’t be possible in fstab, you’ll need to use autofs for that. That package can be installed.

dnf install autofs

Well, using x-systemd.automount has worked FINE in fstab for SMB/cifs volumes for the last number of years…

I’ve used autofs in the past and it also worked fine, but adding one option in fstab is just a whole heck of a lot easier.

2 Likes

@fredex is correct: the SystemD’s automounter can be used in fstab.

1 Like

My bad :slight_smile: didn’t realise there was a systemd option for it, but yeah that would simplify things than compared to autofs.

The man mount tells that various userland tools (e.g. systemd) can look at options is fstab and that the x-* (ā€˜x-’ prefix) in option name shows that the option is more for those than for mount itself.

The systemd generates mount units for everything in fstab, for mounts that autofs has made, and whatnot. It can also create automount units to manage some of the mount units. See man systemd.mount

The units can be a bit of hassle/baffling, if/when edit of /etc/fstab has no immediate effect until the units are updated with daemon-reload or something.

IIRC, it was late el7 point update that did add the ā€˜x-systemd.idle-timeout’ support into systemd – before that systemd did automount, but never autoumount, unlike autofs.


What version of NFS (vers=?) does it actually use?

As I wrote/implied earlier, the fstype can be auto in fstab until you find the correct combo of options.

This is what I have in my fstab file, it is in Debian Testing, not Rocky Linux, but in Debian it works fine. The NAS is also a Synology NAS, just not the same one as yours, & with a different DSM version:

192.168.100.35:/volume1/KVMVMs5 /mnt/KVMVMs5 nfs nolock,rw,sync,hard,intr,_netdev,auto,nofail,x-systemd.after=network-online.target,x-systemd.automount 0 0

My Rocky 9 system (just checked now), mounts fine with the following:

mount synology:/volume1/clonezilla /mnt/nfs

the share when mounted then shows the following by default:

synology:/volume1/clonezilla on /mnt/nfs type nfs4 (rw,relatime,vers=4.1,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.122.186,local_lock=none,addr=10.10.10.100)

I only had the nfs-utils package to install for me to be able to mount nfs without problems. That said on the synology side, you do need to have specific configuration, of which I did have to play around with a bit when I did it.

I’m not using kerberos either for my mounts, but this is at least what works for me. In fact even on another share, I’ve got kerberos integrity disabled and only AUTH_SYS selected, and that also mounts fine as nfs4.

I’m no longer having trouble with the mount, mostly,… though the automount doesn’t seem to work when I attempt to test it. I consider that small potatoes and haven’t dug deeply yet, but probably will in the future.

I’ve had trouble getting reasonable permissions on the files. The Synology suggestion of using ā€œno mappingā€ left me with a mess wherein I couldn’t easily browse the files. I tried several things and now use ā€œmap all users to adminā€, which mostly works, i.e., all the files seem to get copied to the backup device, but looking at the rsnapshot logs shows most (if not all) got a chmod error. I assume that after writing the file that rsnapshot (or rsync, used by rsnapshot) is attempting a chmod on the file which fails. I’m guessing that it is because there is some discrepancy between my main box and the Synology box in re group IDs. Another thing I’ll be checking out as time permits.

But it appears all the files get there, so I should be able to copy files back if I need to.

So, progress has happened (and is ongoing, one hopes)!

Fred

1 Like