NFS服务器搭建
1. 安装nfs-kernel-server,然后编辑/etc/exports。
/sambadata/nfsserver 10.0.0.0/255.255.255.0(fsid=0,all_squash,anonuid=109,anongid=111,rw,no_subtree_check,crossmnt,sync)
我在配置过程中遇到创建的文件所有者和组都是nobody的问题,在加入了all_squash这个参数,并指定uid和gid后,恢复正常。
另外就是service nfs-kernel-server restart & service rpcbind restart
2. 客户端挂载: mount -t nfs 10.0.0.2:/sambadata/nfsserver /mnt/glanceimages
参考: http://linux.vbird.org/linux_server/0330nfs.php#nfsserver_exports
附上exports参数解释:
| 参数 | 说明 |
| ro | 只读访问 |
| rw | 读写访问 |
| sync | 所有数据在请求时写入共享 |
| async | nfs在写入数据前可以响应请求 |
| secure | nfs通过1024以下的安全TCP/IP端口发送 |
| insecure | nfs通过1024以上的端口发送 |
| wdelay | 如果多个用户要写入nfs目录,则归组写入(默认) |
| no_wdelay | 如果多个用户要写入nfs目录,则立即写入,当使用async时,无需此设置 |
| hide | 在nfs共享目录中不共享其子目录 |
| no_hide | 共享nfs目录的子目录 |
| subtree_check | 如果共享/usr/bin之类的子目录时,强制nfs检查父目录的权限(默认) |
| no_subtree_check | 不检查父目录权限 |
| all_squash | 共享文件的UID和GID映射匿名用户anonymous,适合公用目录 |
| no_all_squash | 保留共享文件的UID和GID(默认) |
| root_squash | root用户的所有请求映射成如anonymous用户一样的权限(默认) |
| no_root_squash | root用户具有根目录的完全管理访问权限 |
| anonuid=xxx | 指定nfs服务器/etc/passwd文件中匿名用户的UID |
| anongid=xxx | 指定nfs服务器/etc/passwd文件中匿名用户的GID |
浙公网安备 33010602011771号