MacOSX上的NFS文件共享

在MacOSX上接触过rsync方式文件共享和NFS方式文件共享,两种方式的基本使用方式如下:

1. rsync方式:

    这种方式和scp用法很像

rsync file1 user@host:/xx/file2

    如果传输目录,需要加一个-a参数。如果传输目录过程担心传递发生意外问题,可以空跑一次,就是模拟一次传输,并不是真的传过去。-n是模拟,-v是看到详情。这样执行

  rsync -nva dir user@host:/xx/


2. NFS方式:

    这种方式主要是配置/etc/exports文件,如果exports文件不存在,则创建该文件,并根据MacOSX_NFS_exports.txt格式,编写导出目录。

sudo nfsd enable #确认NFSD服务开启。

sudo nfsd restart #如果nfsd已经启动,需要重启才会生效。

sudo nfsd update #刷新NFSD共享资源。

showmount -e #显示当前共享的资源

客户端进行对导出的目录进行挂载:sudo mount -t nfs 192.168.100.222:/Users/nfs

以前在Linux上设置NFS文件共享感觉很顺利,网上的资料和例子也一大堆,根据配置,就可以顺利的实现文件共享,可是在MacOSX上,NFS的共享方式貌似跟Linux有些差异,其主要差别在与exports文件的编写上,以至于上次在项目中由于NFS在MacOSX上挂载不上,导致不得不另想其他办法,因此有了rsync方式在MacOSX上的实验。后来,经过不懈的努力,终于在MacOSX上搞好了NFS共享。其exports文件的书写方式,可以在MacOSX终端上查询帮助:man exports,即可找出其书写格式和各个参数的意义,其解释如下:


NAME

     exports -- define remote mount points for NFS mount requests


SYNOPSIS

     exports


DESCRIPTION

     The exports file specifies remote mount points for the NFS mount protocol

     per the NFS server specification; see Network File System Protocol

     Specification RFC 1094, Appendix A and NFS: Network File System Version 3

     Specification, Appendix I.


     Fields are separated by space or tab characters.  Lines that begin with a

     # are considered comments and are ignored.


     Each line in the file specifies one or more exported directories, any

     additional mountable sub-directories within those directories, export

     flags, and one or more hosts (if access to the export is to be

     restricted).  All directories on the line must exist within the same

     local file system.


     Within a file system there may be several exported sub-directories with

     different export options.  However, none of those exported directories

     may lie within another.


     A host may be specified only once for each exported directory and there

     may be only one default entry for each exported directory that applies to

     all other hosts.  The latter exports the file system to the ``world'' and

     should be used on

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值