幸运儿不是我,因为我选择的路很难走.如果够出色也不能出头,至少要做到没第二个我.
分类: LINUX
2012-10-24 14:40:47
测试环境:
[root@tp system]# uname -a
Linux tp 3.3.4-5.fc17.x86_64 #1 SMP Mon May 7 17:29:34 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
配置nfs exports:
vim /etc/exports
激活exports,可直接用exportfs刷新或者重启服务:
1. exportfs刷新:
[root@tp system]# exportfs -avf
exporting 192.168.221.0/24:/run/media/k/Elements/unzip/ora11gR2forLinux64
2. 重启服务:
[root@tp system]# systemctl restart nfs-server.service
查看本机共享出的nfs文件夹:
[root@tp system]# showmount -e
Export list for tp:
/run/media/k/Elements/unzip/ora11gR2forLinux64 192.168.221.0/24
换台机器挂载nfs文件夹:
[root@rac1 ~]# mount -t nfs 192.168.221.1:/run/media/k/Elements/unzip/ora11gR2forLinux64 /mnt
[root@rac1 ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/mapper/VolGroup00-LogVol00
188G 2.7G 176G 2% /
/dev/sda1 99M 23M 71M 25% /boot
tmpfs 2.0G 0 2.0G 0% /dev/shm
/dev/sr0 3.6G 3.6G 0 100% /media
192.168.221.1:/run/media/k/Elements/unzip/ora11gR2forLinux64
932G 806G 127G 87% /mnt
[root@rac1 ~]#
注意问题:
1. 检查配置没有问题后,仍无法发现nfs共享,可以先临时关闭防火墙(systemctl stop iptables.service)和SELINUX(setenforce 0),再试试看。
2. 客户机上能发现nfs共享,并且可以成功mount,但是没有权限列出mount后的目录,需要加no_root_squash到nfs exports选项里,这样客户机能以root权限来查看nfs共享文件夹。
man exports
root_squash
Map requests from uid/gid 0 to the anonymous uid/gid. Note that
this does not apply to any other uids or gids that might be
equally sensitive, such as user bin or group staff.
no_root_squash
Turn off root squashing. This option is mainly useful for disk‐
less clients.
REF:
1. Fedora 17 - NFS Server : Server World