简单的局域网共享硬盘,尚未解决,记录一把

本文介绍如何通过NFS服务将A机器的/data/a目录映射到B机器的相同路径下,包括配置NFS服务、设置权限及挂载操作等关键步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

转载记录:

https://segmentfault.com/a/1190000009116022

 

需求

把A机器的目录/data/a 映射到B机器的/data/a目录下
A内网ip:192.168.0.111
B内网ip:192.168.0.222

A机器配置要求:

1.启动NFS服务(/etc/init.d/nfs start )

2.在/etc/exports文件内添加映射权限(被映射的目录和可以允许的地址):

/data/a 192.168.0.222((rw,sync,no_root_squash)

说明:
允许ip地址范围在192.168.0.222的计算机以读写的权限来访问/data/a 目录。 
rw:读/写权限,只读权限的参数为ro;
sync:数据同步写入内存和硬盘,也可以使用async,此时数据会先暂存于内存中,而不立即写入硬盘。
no_root_squash:NFS 服务器共享目录用户的属性,如果用户是 root,那么对于这个共享目录来说就具有 root 的权。

3:重启NFS 服务:

service nfs restart

B机器配置:

1.mkdir /data/a

2.然后挂载 mount 192.168.1.111:/data/a /data/a

取消挂载的命令是 umount /data/a

ok在B机器上打开/data/a实际就是访问A的/data/a目录。

备注:
1.A的相应端口需要释放,确保没有防火墙阻拦
2.有问题时可以用rpcinfo -p server 检查各端口情况,确保nfs服务启动
3.磁盘根目录不能做映射

 

https://askubuntu.com/questions/525243/why-do-i-get-wrong-fs-type-bad-option-bad-superblock-error

后面尚未尝试解决,先做个记号

问题出现类似为

he error message mentions:

(for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount. helper program)

This is relevant given that you are trying to mount NFS. The /sbin/mount.nfs helper program is provided by nfs-common. You can install it with:

sudo apt install nfs-common

On the other hand, if you are trying to mount CIFS, the helper program is provided by cifs-utils. You can install it with:

sudo apt install cifs-utils
mount: wrong fs type, bad option, bad superblock on 192.168.1.5:/home/shared, missing codepage or helper program, or other error (for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program)  
In some cases useful info is found in syslog - try dmesg | tail or so.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值