赞
踩
@[TOC]NFS文件网络共享
官网:http://nfs.sourceforge.net/
sudo yum install nfs-utils
sudo apt-get install nfs-common
sudo nfsd enable sudo nfsd start sudo nfsd restart
sudo vi /etc/exports
# -alldirs 挂载该目录下的所有子目录 -network -mask 可以不写,默认就是允许所有
# /Users/modongxiao/data 就是本地的目录,以此为nfs的基础
/Users/modongxiao/data -alldirs
sudo nfsd enable
sudo nfsd start
sudo nfsd restart
# nfs 常用命令
localhost:docker modongxiao$ nfsd -h
nfsd: illegal option -- h
usage: nfsd [-NRrtuv] [-F export_file] [-n num_servers] [-p nfsport] [-P mountport] [command]
commands: enable, disable, start, stop, restart, update, status, checkexports, verbose [up|down]
localhost:docker modongxiao$ showmount -e
Exports list on localhost:
/Users/modongxiao/mvc Everyone
/Users/modongxiao/data Everyone
sudo mount -o sync -t nfs 127.0.0.1:/Users/modongxiao/data /Users/modongxiao/nfs/data
sudo mount -o sync -t nfs 127.0.0.1:/Users/modongxiao/mvc /Users/modongxiao/nfs/mvc
localhost:docker modongxiao$ mount
127.0.0.1:/Users/modongxiao/data on /Users/modongxiao/nfs/data (nfs, asynchronous)
127.0.0.1:/Users/modongxiao/mvc on /Users/modongxiao/nfs/mvc (nfs, asynchronous)
localhost:docker modongxiao$ df -h
127.0.0.1:/Users/modongxiao/data 466Gi 69Gi 396Gi 15% 575985 4155327920 0% /Users/modongxiao/nfs/data
127.0.0.1:/Users/modongxiao/mvc 466Gi 69Gi 396Gi 15% 575985 4155327920 0% /Users/modongxiao/nfs/mvc
bogon:.ssh modongxiao$ sudo umount 127.0.0.1:/Users/modongxiao/data
Password:
bogon:.ssh modongxiao$ df -h
127.0.0.1:/Users/modongxiao/mvc 466Gi 70Gi 396Gi 15% 591788 4152799280 0% /Users/modongxiao/nfs/mvc
bogon:.ssh modongxiao$ sudo nfsd stop
The nfsd service is not running.
如果发现卸载时被占用,可以直接使用 sudo nfsd stop 停止
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。