Linux NFS磁盘共享

本内容基于redhat。

1、配置nfs磁盘共享

# vim /etc/exports

/opt/nfs 192.168.227.4(rw,sync,fsid=0) 192.168.227.5(rw,sync,fsid=0)    
/opt/nfs1 192.168.227.0/24(rw,sync,all_squash,anonuid=0,anongid=0)

加入第二行,anonuid=0,anongid=0即为root用户id。

2、启动

#启动
service nfs start
#重启
service nfs restart

#让修改过的配置文件生效
exportfs –arv

3、 查看新的可挂载目录及可连接的IP

showmount -e 192.168.227.3

4、想在客户机B、C上实现开机挂载,则需要编辑/etc/fstab。

vim /etc/fstab
加入以下内容:

192.168.227.3:/opt/nfs                  /opt/nfs    nfs    nolock   0 0   
192.168.227.3:/opt/nfs1               /opt/nfs1  nfs    nolock   0 0

保存后,重新挂载
mount -a

5、手工挂载:

mount -t nfs -o rw 10.49.56.18:/mnt/data /lan01

***********************************************************************************************

author:蓝何忠
email:lanhezhong@163.com
***********************************************************************************************


版权声明:本文为lanhezhong原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。