码迷,mamicode.com
首页 > 系统相关 > 详细

linux NFS

时间:2018-03-03 19:25:12      阅读:251      评论:0      收藏:0      [点我收藏+]

标签:exe   生效   sys   systemd   创建   .com   started   cst   网络文件   

NFS网络文件服务器:

技术分享图片

 

技术分享图片

windows上面叫文件共享。
多台linux服务器,只要有一台搭建了NFS服务器并把文件共享出来,其余几台服务器就可以来访问。

技术分享图片

技术分享图片

root@ubuntu:/etc# service portmap status
● rpcbind.service - RPC bind portmap service
   Loaded: loaded (/lib/systemd/system/rpcbind.service; indirect; vendor preset: enab
  Drop-In: /run/systemd/generator/rpcbind.service.d
           └─50-rpcbind-$portmap.conf
   Active: active (running) since 日 2018-02-25 05:50:45 PST; 1h 30min ago
root@ubuntu:/etc# service nfs-utils start
root@ubuntu:/etc# service nfs-utils status
● nfs-utils.service - NFS server and client services
   Loaded: loaded (/lib/systemd/system/nfs-utils.service; static; vendor preset: enab
   Active: active (exited) since 日 2018-02-25 07:22:33 PST; 6min ago
  Process: 6007 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
 Main PID: 6007 (code=exited, status=0/SUCCESS)

2月 25 07:22:30 ubuntu systemd[1]: Starting NFS server and client services...
2月 25 07:22:33 ubuntu systemd[1]: Started NFS server and client services.
2月 25 07:28:39 ubuntu systemd[1]: Started NFS server and client services.

技术分享图片

root@ubuntu:/etc# ll | grep exports
-rw-r--r--   1 root root     389 10月 10  2012 exports
root@ubuntu:/etc# vim exports
/home/nfs  *(sync,ro)

技术分享图片

技术分享图片

技术分享图片

写完之后要重启nfs和portmap才能够生效。

root@ubuntu:/etc# service portmap restart
root@ubuntu:/etc# service nfs-utils restart

我们要共享的目录是/home/nfs,现在nfs所属的账号是root,要改成nfs,
root@ubuntu:/home# mkdir nfs
root@ubuntu:/home# ll
drwxr-xr-x  2 root   root    4096 2月  25 07:39 nfs/


nfs账号是存在的,root@ubuntu:/home# vim /etc/passwd
nfsnobody:x:125:65534::/var/lib/nfs:/bin/false

root@ubuntu:/home# chown -R  nfsnobody:nfsnobody nfs/ (修改文件的宿主)

NFS服务端需要启动2个进程,并修改配置文件,修改文件宿主。
客户端:
创建一个目录/mnt/share
chown -R  nfsnobody:nfsnobody  share/
mount  -t  nfs  192.168.229.134:/home/nfs  /mnt/share(把另一台服务器共享的文件192.168.229.134:/home/nfs映射到本地来/mnt/share)

 

linux NFS

标签:exe   生效   sys   systemd   创建   .com   started   cst   网络文件   

原文地址:https://www.cnblogs.com/yaowen/p/8502566.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!