linux系统下挂载局域网内其他操作系统的目录

参考:https://www.cnblogs.com/freeweb/p/6593861.html

1.Linux使用mount挂载Windows共享文件夹

mount -t cifs -o username=a***n,password=s***t //192.168.***.45/g****i_Sh***e /usr/local/****/restore/

2.Linux使用mount挂载linux系统文件夹

目标机器上开启服务如下

rpm -qa | grep nfs-utils
rpm -qa | grep rpcbind
yum -y install nfs-utils
yum -y install rpcbind

安装完成之后配置nfs访问目录,配置文件位置/etc/exports,默认是空的这里添加一行:

/nfs_test 192.168.212.45(rw,no_root_squash,no_all_squash,async)

 

现在配置完这些配置,启动相关服务:

systemctl start rpcbind.service
systemctl start nfs.service

 

服务器上配置如下:

首先创建挂载点: mkdir /mnt/test1 

然后挂载nfs: mount -t nfs 192.168.212.46:/nfs_test /mnt/test1 

如果需要设置开机挂载,在/etc/fstab添加一行配置即可: 192.168.212.46:/nfs_test /mnt/test1 nfs rw,tcp,intr 0 1  然后服务端和客户端都要用enable设置nfs和rpcbind服务开机启动,然后才可以正常挂载

3. 卸载

# umount /usr/local/suninfo/restore/

umount 时提示错误 target is busy. (In some cases useful info about processes that use the device is found by lsof(8) or fuser(1)) , 你可以先切换到别的目录再试一次 , 原因也可能是其他进程可能在使用目录 , 可以先关闭使用该目录的进程 , 然后再 umount , 命令如下 (使用 fuser 需安装 psmisc # yum install psmisc) :

# fuser -m /usr/local/suninfo/restore/
/usr/local/suninfo/restore/:  2806c

# ps aux | grep 2806
root      2806  0.0  0.5 116040  2836 pts/0    Ss   11:31   0:00 -bash
root      2925  0.0  0.1 112648   960 pts/0    S+   14:36   0:00 grep --color=auto 2806

# kill -9 2806

# umount /usr/local/suninfo/restore/

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值