Ubuntu配置nfs服务器

1.安装nfs
sudo apt-get install nfs-kernel-server #安装nfs-kernel-server时,apt会自动安装nfs-common和portmap

2、配置nfs
sudo vi /etc/exports

例如
/opt  192.168.1.108(rw,sync,no_root_squash) /* ubuntu12.04下测试IP地址必须写全 */

/opt           - 要挂载的目录。
192.168.1.108  - NFS客户端的IP地址。
rw             - 读/写权限,只读权限的参数为ro。
sync           - 数据同步写入内存和硬盘,也可以使用async,此时数据会先暂存于内存中,而不立即写入硬盘。
no_root_squash - NFS服务器共享目录用户的属性,如果用户是root,那么对于这个共享目录来说就具有root的权限。

修改完成之后输入以下命令使配置文件生效:
exportfs –r

3、重启nfs服务
sudo /etc/init.d/nfs-kernel-server restart

4、nfs服务器端测试
由于nfs服务器端默认是安装了nfs客户端(nfs-common)的,所以可以在服务器端挂载共享文件夹作测试。
sudo mount 192.168.1.108:/opt/mnt #192.168.1.108是nfs服务器端IP地址

如果看到/mnt文件下包含/opt文件夹里的内容,就说明挂载成功。

要卸载nfs的挂载用命令:
sudo umount /mnt

5、nfs挂载根文件系统常见问题
(1)挂载服务器目录到开发板出现:rpcbind: server localhost not responding, timed out

例如:

[root@FriendlyARM /]# mount -t nfs 192.168.1.108:/nfsroot/rootfs /mnt

rpcbind: server localhost not responding, timed out
svc: failed to register lockdv1 RPC service (errno 5).
lockd_up: makesock failed, error=-5
rpcbind: server localhost not responding, timed out
rpcbind: server localhost not responding, timed out
rpcbind: server localhost not responding, timed out

解决办法:加上“-o nolock”参数
[root@FriendlyARM /]# mount -t nfs -o nolock 192.168.1.108:/nfsroot/rootfs /mnt
[root@FriendlyARM /]#

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值