服务器间共享挂载操作

问题:

服务器192.168.0.194及服务器192.168.0.211,现资源文件位于192.168.0.194上,现在需要在192.168.0.211上面访问到192.168.0.194上的对应文件,故需要进行服务器间共享文件操作。

操作:

首先需要启动192.168.0.194服务器的nfs服务
1.在192.168.0.194下查看nfs是否安装

rpm -qa|grep nfs

2.若尚未安装nfs,则可以执行简单安装办法

yum -y install nfs

3.已安装nfs,则在192.168.0.194上编辑配置文件

vi /etc/exports
//配置内容如下:
/web/data/bank_upfiles/ 192.168.0.211(rw,sync,no_root_squash)

4.配置完成后启动nfs服务

/etc/init.d/nfs start
//或者
service nfs start

5.启动成功后检查nfs服务启动情况

service nfs status

6.然后在192.168.0.211上面执行挂载命令

mount -t nfs 192.168.0.194:/web/data/bank_upfiles /web/data/bank_upfiles

7.挂载成功后查看已挂载的共享目录

mount -l

8.如果需要取消挂载

umount /web/data/bank_upfiles/
//注:如果取消挂载提示
umount2: Device or resource busy
umount.nfs: /web/data/bank_upfiles/: device is busy
umount2: Device or resource busy
umount.nfs: /web/data/bank_upfiles/: device is busy
//可以用命令
fuser -m -v /web/data/bank_upfiles/
//kill 掉对应的进程再重新执行取消挂载操作

9.停用nfs服务

service nfs stop

10.遇到一个nfs挂载错误的问题

mount: wrong fs type, bad option, bad superblock on 192.168.0.194:/web/project/doc_edu,
       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

根据错误提示,查看/sbin/mount.文件,果然发现没有/sbin/mount.nfs的文件,安装nfs-utils即可

apt-get install nfs-common
//或者
yum install nfs-utils

: 另附加查看磁盘存储空间命令

df -hl
//或者
du -sh * | sort -n

猜你喜欢

转载自blog.csdn.net/csdn565973850/article/details/78615543
今日推荐