9

This is my nfs service status in Fedora 32:

[dolphin@MiWiFi-R4CM-srv infrastructure]$ sudo systemctl status nfs-server.service
● nfs-server.service - NFS server and services
     Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; enabled; vendor preset: disabled)
    Drop-In: /run/systemd/generator/nfs-server.service.d
             └─order-with-mounts.conf
     Active: active (exited) since Sun 2020-07-19 04:16:50 EDT; 2h 34min ago
    Process: 599370 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
    Process: 599371 ExecStart=/usr/sbin/rpc.nfsd (code=exited, status=0/SUCCESS)
    Process: 599381 ExecStart=/bin/sh -c if systemctl -q is-active gssproxy; then systemctl reload gssproxy ; fi (code=exited, status=0/SUCCESS)
   Main PID: 599381 (code=exited, status=0/SUCCESS)
        CPU: 37ms

Jul 19 04:16:50 MiWiFi-R4CM-srv systemd[1]: Starting NFS server and services...
Jul 19 04:16:50 MiWiFi-R4CM-srv systemd[1]: Finished NFS server and services.

and this is my exports file config in /etc/exports:

[dolphin@MiWiFi-R4CM-srv infrastructure]$ cat /etc/exports
/home/dolphin/data/k8s/monitoring/infrastructure/jenkins *(rw,all_squash)

when I trying to test my nfs servcie using this command :

[dolphin@MiWiFi-R4CM-srv infrastructure]$ mount -t nfs -o v4 192.168.31.2:/home/dolphin/data/k8s/monitoring/infrastructure/jenkins /mnt
mount.nfs: failed to apply fstab options

I am searching from internet but find no one encount this situation.where is going wrong and what shoud I do to fix this?

[dolphin@MiWiFi-R4CM-srv infrastructure]$ showmount -e 192.168.31.2
Export list for 192.168.31.2:
/home/dolphin/data/k8s/monitoring/infrastructure/jenkins *
kofemann
  • 4,626
  • 1
  • 25
  • 30
Dolphin
  • 351
  • 1
  • 7
  • 15

1 Answers1

14

It requires root privilege to mount a remote filesystem. Thus you should do sudo mount ...

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
  • is it possible to mount nfs file system without sudo @Michael Hamption I want to mount it from kubernetes cluster pod. – Dolphin Jul 19 '20 at 11:52
  • 1
    If you place `user` as one of the options in the fstab, then anybody can mount the filesystem. But if it is in fstab, then it will be automatically mounted when the system boots anyway. – Michael Hampton Jul 19 '20 at 11:58
  • You don't need root privileges if **autofs** is configured. It will mount nfs server automatically as soon as users accesses the configured path, which is */net/* by default. – kofemann Jul 20 '20 at 21:44