{"title": "\u642d\u5efaNFS\u670d\u52a1\u5668\u9047\u5230\u7684\u51e0\u4e2a\u95ee\u9898", "update_time": "2013-01-06 13:28:38", "tags": "nfs", "pid": "210", "icon": "linux.png"}
我的NFS服务器是这样配置的: 1.服务端配置文件/etc/exports,内容如下: ``` /home/nfs *(rw,sync) ``` 2.然后启动portmap和nfs ``` service portmap start service nfs start ``` 客户端尝试挂载nfs。`mount -t nfs host:/home/nfs /mnt` 报如下错误: ``` mount.nfs: Connection refused ``` 然后dmesg查看原因: ``` [1354440.411939] svc: failed to register lockdv1 RPC service (errno 111). [1354536.249731] svc: failed to register lockdv1 RPC service (errno 111). [1355967.201334] svc: failed to register lockdv1 RPC service (errno 111). [1359889.611758] svc: failed to register lockdv1 RPC service (errno 111). [1360458.405236] svc: failed to register lockdv1 RPC service (errno 111). [1360472.825690] svc: failed to register lockdv1 RPC service (errno 111). [1360529.892045] svc: failed to register lockdv1 RPC service (errno 111). [1360651.784657] svc: failed to register lockdv1 RPC service (errno 111). [1360750.052449] svc: failed to register lockdv1 RPC service (errno 111). [1360816.619253] svc: failed to register lockdv1 RPC service (errno 111). ``` 应该是客户端没有启动portmap导致,启动客户端的portmap。 ``` service portmap start ``` 再次mount,就ok了。 新的问题出现了,启动后尝试创建问题失败,提示权限不足: ``` #touch a touch: cannot touch `a': Permission denied ``` 从网上找到原因是nfs默认禁止root挂载后操作nfs目录,需要在exports文件里加入no_root_squash这个参数, 于是在服务端修改/etc/exports 如下: ``` /home/nfs *(rw,sync,no_root_squash) ``` 然后重启nfs ``` service nfs restart ``` 问题解决