While I was practicing for RHCSA, I noticed, that for me, the automount part is the most difficult.
For making this thing more memorable, I decided to write a short guide to what I did to get this working and share my knowledge. Maybe this will actually help someone understanding it :)
I'll work with two nodes, nfssrv.archyslife.lan and nfsclnt.archyslife.lan.
The names are kind of obvious what the servers will do.
First, let's set up the server which will share it's files:
[root@nfssrv ~]# yum -y install nfs-utils
[root@nfssrv ~]# vim /etc/exports
/storage 172.31.100.0/24 (rw,secure,sync,no_subtree_check)
[root@nfssrv ~]# mkdir /storage
[root@nfssrv ~]# systemctl enable nfs.service
[root@nfssrv ~]# systemctl start nfs.service
This set of commands will install the nfs-server software, configure your /storage directory to be shared using nfs to the network 172.31.100.0/24 and start the nfs-service on boot.
Now the client-side:
[root@nfsclnt ~]# yum -y install autofs
[root@nfsclnt ~]# vim /etc/auto.master
/autofs /etc/auto.nfs
[root@nfsclnt ~]# vim /etc/auto.nfs
nfs -fstype=nfs,rw nfssrv.archyslife.lan:/storage
[root@nfsclnt ~]# mkdir /autofs
[root@nfsclnt ~]# systemctl enable autofs.service
[root@nfsclnt ~]# systemctl start autofs.service
Let's break this down really quickly:
First, we install the autofs software and edit the master config file for the autofs service.
/autofs is the Directory where my nfs shares are going to be mounted.
Second, we fill the config file mentioned in auto.master with information of how to mount the directories that are shared. The directory 'nfs' cannot exist in autofs unlike you would do with a regular mount. The automounter will create it when being accessed automatically and mount the folder specified in the config file.
Once you get the hang of it, it's fairly simple. I hope this helped a bit in trying to understand how this works.
Feel free to comment and / or suggest any topics.
Comments
Post a Comment