nfs在centos的上面的POC

服务端配置

1. 安装nfs-utils和rpcbind

yum install nfs-utils rpcbind

2.设置开机启动服务

chkconfig nfs on

chkconfig rpcbind on

3.启动相关服务

service rpcbind start

service nfs start

4.创建共享目录

mkdir -p /export/primary

mkdir -p /export/secondary

5.编辑/etc/exports文件添加如下内容

vi /etc/exports

/export *(rw,async,no_root_squash,no_subtree_check)

#export与*之间有空格

6.刷新配置立即生效

exportfs -a


客户端配置

 

1. 安装nfs-utils和rpcbind

yum install nfs-utils rpcbind

2.设置开机启动服务

chkconfig nfs on

chkconfig rpcbind on

3.启动服务

service rpcbind start

service nfs start

4.创建挂载点

mkdir -p /mnt/primary

mkdir -p /mnt/secondary

5.挂载目录

mount -t nfs server_ip:/export/primary /mnt/primary

mount -t nfs 10.20.18.63:/export/primary /mnt/primary

#service_ip以具体的server IP替代

mount -t nfs server_ip:/export/secondary /mnt/secondary

mount -t nfs 10.20.18.63:/export/secondary /mnt/secondary

6.查看挂载的目录

df -h

7.卸载挂载的目录

umount /mnt/primary

umount /mnt/secondary

8.编辑/etc/fstab,开机自动挂载

vi /etc/fstab

server_ip:/export/primary /mnt/primary nfs rw,tcp,intr 0 1

server_ip:/export/secondary /mnt/secondary nfs rw,tcp,intr 0 1

10.20.18.63:/export/primary /mnt/primary nfs rw,tcp,intr 0 1

10.20.18.63:/export/secondary /mnt/secondary nfs rw,tcp,intr 0 1


mount -a,是测试/etc/fstab中的条目是否能全部挂载的命令。



你可能感兴趣的:(nfs)