参考: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/