crecreate nfs share file step
IP: server:192.168.1.225 client:192.168.1.226
server: 1、install nfs yum bug
yum install -y nfs-utils.x86_64 2、start nfs service and rpcbind
service rpcbind start service nfs start 3、configuration share directory vi /etc/exports /usr/local/test/ 192.168.1.226(rw,no_root_squash,no_all_squash,sync)
/usr/local/test/ 为共享的目录,使用绝对路径。 client: 1、create directory need to be munted mkdir /usr/local/test/ 2、test mount: showmount -e 192.168.1.225 3、mount mount -t nfs 192.168.1.225:/usr/local/test /usr/local/test
over
解除挂载: [root@localhost ~]# umount /usr/local/test [root@localhost ~]# mount /dev/mapper/VolGroup-lv_root on / type ext4 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) tmpfs on /dev/shm type tmpfs (rw) /dev/sda1 on /boot type ext4 (rw) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw) nfsd on /proc/fs/nfsd type nfsd (rw) [root@localhost ~]# 如果遇到:umount.nfs: /usr/local/test: device is busy 可能用命令: [root@localhost /]# fuser -m -v /usr/local/test 用户 进程号 权限 命令 /usr/local/test/: root 2798 ..c.. bash root 2996 ..c.. su [root@localhost /]# kill -9 2798 [root@localhost /]# kill -9 2996 [root@localhost /]# umount /usr/local/test [root@localhost /]# 六、服务器端防火墙设置(NFS 开启防墙配置): 1、修改/etc/service,添加以下内容(端口号必须在1024以下,且未被占用)
# Local services 2、重起Linux NFS服务 service nfs restart 3、此时rpc相关端口已经被固定,可以为Linux NFS添加防火墙规则
#portmap
---TCP方法成功------------------------------------------- 客户端在挂载的时候遇到的一个问题如下,可能是网络不太稳定,NFS默认是用UDP协议,换成TCP协议即可:
mount -t nfs 192.168.1.225:/usr/local/test /usr/local/test -o proto=tcp -o nolock |