Linux Centos7 remote mount network disk / shared directory -NFS shared folder operations

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/bj_chengrong/article/details/90271418

Server operation

[1] NFS installation program

yum -y install nfs*

rpcbind, yum comes in previous centos6 source for portmap.

Download will depend on when using yum install nfs, so just download nfs without the need to download rpcbind.


[2] to see if the nfs and rpcbind installation

rpm -qa | grep nfs

rpm -qa |grep rpcbind


[3] to create a shared directory and shared

To share the directory already exists please skip the creation (can also be created manually)

mkdir  /mnt/NFS/resource


Then edit the following files:

vim /etc/exports

- The following is added to the file / etc / exports in

/mnt/NFS/resource  10.8.200.202/24(rw,no_root_squash,sync,no_wdelay)

/mnt/NFS/resource  10.8.200.205/24(rw,no_root_squash,sync,no_wdelay)

[4] start nfs, rpcbind, and is set to boot from Kai

(centos7)

systemctl start nfs

systemctl start rpcbind

systemctl enable nfs

systemctl enable rpcbind

(Centos6)

service nfs start

service rpcbind start


[5] see if the shared success

showmount -e localhost

Can see the shared directories and client, that is success

If the following error report, you need to take off the firewall

 ==========================================================================================

Client Operations

 

[1] NFS installation program

yum -y install nfs*


[2] nfs start

(centos7)

systemctl start nfs

systemctl start rpcbind

systemctl enable nfs

systemctl enable rpcbind

(Centos6)

service nfs start

service rpcbind start

chkconfig nfs on

chkconfig rpcbind on


[3] Create a mount directory

mkdir / res_base / prd /


[4] to see if the shared success

showmount -e nfs server IP (10.8.200.204 is an NFS server)

showmount -e 10.8.200.204    

10.8.200.202,10.8.200.205 remote access to a shared server, client IP


[5] network mount

mount -t nfs -o nolock server IP: shared directory absolute path to a local mount directory

mount -t nfs -o nolock 10.8.200.204:/mnt/NFS/resource/  /res_base/prd

Boot automatically mount

vi / etc / fstab

# Add a new row

10.8.200.132:/mnt/NFS/resource/ /res_base/prd                    nfs4    defaults        0 0

centos7 of nfs default is nfs4, so mount -t without specifying nfs4 can


[6] see if success

df -Th 

[7] offload network disk

And unloading the same local mount

umount /res_base/prd

or

umount 10.8.200.132:/mnt/NFS/resource   

 

 

 

 

Guess you like

Origin blog.csdn.net/bj_chengrong/article/details/90271418