I’m trying to configure mounting on demand between RedHat machine which is the server machine in this case and CentOS which is the client machine. I have configured the following:
On RedHat server machine I’ve installed nfs-utils, started nfs-server service and edited /etc/exports file:
I also reloaded autofs service and stopped firewall on RHEL machine. But when I try to access on /shares/mynetworkshare I got the message there is no mynetworkshare dir. Please let me know if I’m right, we are supposed to install and configure autofs only on the client machine where we are going to access on desire dir which should be mounted on demand ?
On the client side I also fixed /etc/auto.shares file:
[armin@centos-h1 mynetworkshare]$ cat /etc/auto.shares
mynetworkshare -fstype=auto 172.25.5.7:/opt/on_demand_server
[armin@centos-h1 mynetworkshare]$ sudo showmount --exports 172.25.5.7
Export list for 172.25.5.7:
/opt/on_demand_server 172.25.5.6
Finally, everything works fine now:
[armin@centos-h1 mynetworkshare]$ pwd;ls -la
/shares/mynetworkshare
total 4
drwxr-xr-x. 2 root root 4096 Mar 20 13:15 .
drwxr-xr-x. 3 root root 0 Mar 20 13:11 ..
-rw-r--r--. 1 root root 0 Mar 20 13:15 something
Just one more question - is it ok if I can see /shares/mynetworkshare mountpoint as the output of df command or it should be mounted only if there is some r/w operation on this mountpoint ?
[armin@centos-h1 ~]$ df -h -t nfs4
Filesystem Size Used Avail Use% Mounted on
172.25.5.7:/opt/on_demand_server 974M 0 907M 0% /shares/mynetworkshare