NFS

来源:互联网 发布:2017年云计算市场份额 编辑:程序博客网 时间:2024/06/06 13:06

NFS端口号2049

rpc端口号111

[root@www ~]# yum install nfs-utils rpcbind -y

nfs的daemon会随机向rpc注册端口,为了在防火墙好管理

[root@www ~]# vim /etc/sysconfig/nfs

共享目录

[root@www ~]# vim /etc/exports

/xx     192.168.130.0/24(rw,sync)

当共享为一个主机是子网掩码为32.。24位一个网段的所有主机

[root@www ~]# vim /etc/exports

/xx     192.168.130.140/32(rw,sync) 192.168.130.0/24(ro,sync)


查看默认文件共享权限

[root@www ~]# cat /var/lib/nfs/etab
/xx    192.168.130.0/24(rw,sync,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,no_subtree_check,secure_locks,acl,anonuid=65534,anongid=65534,sec=sys,rw,root_squash,no_all_squash)
root_squash  root用户进行压缩成nobody


nfs重启是不要用service nfs restart  这样在client链接会很慢

[root@www ~]# exportfs -arv   r重新挂载,v显示过程

在client查看server端共享的目录

showmount -e serverIP

mount -o bg 192.168.130.139:/xx  在后台进行挂载,查看更多挂载选项查看[root@www ~]# vim /etc/nfsmount.conf


在客户端当访问目录时进行自动挂载

当我访问/mnt/cdrom时自动进行挂载光盘

yum install autofs -y

service autofs stop

service autofs start

不能用restart重启

[root@www ~]# vim /etc/auto.master

/mnt (父目录)   /etc/auto.aa
[root@www ~]# cp /etc/auto.misc /etc/auto.aa

cdrom(子目录)        -fstype=iso9660      :/dev/cdrom(光盘)

nfs                           -fstype=nfs,rw            192.168.130.139:/xx

当访问/mnt/cdrom 时,系统自动挂载/dev/cdtom   /mnt/cdrom













原创粉丝点击