Mount and unmount NFS network file systems

First, we are going to install the nfs-utils package:

# yum install nfs-utils

We need to know what the server is sharing:

[root@cliente1 ~]# showmount -e servidoripa.example.com
 Export list for servidoripa.example.com:
 /srv/nfs   *
 /home/ldap *

In the previous command, we can see that the ipa server is sharing two directories. We are going to mount the nfs directory:

Temporary mount

[root@cliente1 mnt]# mount -t nfs servidoripa.example.com:/srv/nfs /mnt/temp-nfs/

[root@cliente1 mnt]# mount | grep nfs   <-- to see the nfs version.
 sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw,relatime)
 nfsd on /proc/fs/nfsd type nfsd (rw,relatime)
 servidoripa.example.com:/srv/nfs on /mnt/temp-nfs type nfs4 (rw,relatime,vers=4.0,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=192.168.122.110,local_lock=none,addr=192.168.122.230)

[root@cliente1 mnt]# ls -las temp-nfs/
 total 0
 0 drwxr-xr-x. 2 nfsnobody root  6 Jun  8  2018 .
 0 drwxr-xr-x. 9 root      root 94 May 12 18:03 ..

[root@cliente1 mnt]# umount temp-nfs/

Permanent mount

[root@cliente1 temp-nfs]# echo "servidoripa.example.com:/srv/nfs /mnt/temp-nfs/ nfs _netdev 0 0" >> /etc/fstab

 [root@cliente1 temp-nfs]# df -h
 Filesystem              Size  Used Avail Use% Mounted on
 /dev/mapper/myvg1-root  6.3G  3.1G  3.3G  49% /
 devtmpfs                905M     0  905M   0% /dev
 tmpfs                   920M  156K  920M   1% /dev/shm
 tmpfs                   920M  9.0M  911M   1% /run
 tmpfs                   920M     0  920M   0% /sys/fs/cgroup
 /dev/vda1              1014M  173M  842M  17% /boot
 /dev/mapper/vg2-lv03     70M  1.6M   63M   3% /mnt/lv03
 /dev/mapper/vg2-lv04     43M  1.1M   39M   3% /mnt/lv04
 /dev/mapper/vg1-lv01    400M  2.3M  376M   1% /mnt/lv01
 /dev/mapper/vg1-lv02     74M  1.6M   67M   3% /mnt/lv02
 tmpfs                   184M  4.0K  184M   1% /run/user/42
 tmpfs                   184M   12K  184M   1% /run/user/1000
 tmpfs                   184M     0  184M   0% /run/user/0

 [root@cliente1 temp-nfs]# mount -a

 [root@cliente1 temp-nfs]# df -h
 Filesystem                        Size  Used Avail Use% Mounted on
 /dev/mapper/myvg1-root            6.3G  3.1G  3.3G  49% /
 devtmpfs                          905M     0  905M   0% /dev
 tmpfs                             920M  156K  920M   1% /dev/shm
 tmpfs                             920M  9.0M  911M   1% /run
 tmpfs                             920M     0  920M   0% /sys/fs/cgroup
 /dev/vda1                        1014M  173M  842M  17% /boot
 /dev/mapper/vg2-lv03               70M  1.6M   63M   3% /mnt/lv03
 /dev/mapper/vg2-lv04               43M  1.1M   39M   3% /mnt/lv04
 /dev/mapper/vg1-lv01              400M  2.3M  376M   1% /mnt/lv01
 /dev/mapper/vg1-lv02               74M  1.6M   67M   3% /mnt/lv02
 tmpfs                             184M  4.0K  184M   1% /run/user/42
 tmpfs                             184M   12K  184M   1% /run/user/1000
 tmpfs                             184M     0  184M   0% /run/user/0
 servidoripa.example.com:/srv/nfs   17G  7.0G   11G  42% /mnt/temp-nfs

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *