MacOSX上的NFS文件共享

2023-10-29

在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 only when the file system contains public information.

     Any attempt to export the same directory to a host with different export

     options will cause the conflicting export entry to be rejected.


     The first field(s) of an export entry is a list of directories on a local

     file system to export.  At least one pathname must be to an exported

     directory.  Other pathnames may refer to sub-directories of the exported

     directory to indicate that hosts are also allowed to explicitly mount

     those sub-directories of the exported directory.  (Note that the -alldirs

     flag can be used to allow mounting any sub-directories of the pathnames

     specified.)


     Mount points for a file system may appear on multiple lines, each with

     different sets of hosts and export options.


     The pathnames must not have any symbolic links in them and should not

     have any "." or ".." components.  Single and double quote characters

     occuring in a pathname must be escaped with \' and \", respectively.

     Space characters occuring in a pathname must be escaped, or alterna-

     tively, the pathname can be enclosed in single or double quotes.


     Note that because an export entry only lists a set of pathnames, it is up

     to the NFS server to correctly determine what file system is meant to be

     exported by that entry.  To that end, the server will attempt to intelli-

     gently decide which file system best matches the entry by comparing all

     the pathnames with both the current list of mounted file systems and the

     list of previously-exported file systems.  If the server determines that

     the intended file system is not available, it will automatically mark

     that export as offline until the file system becomes available (see the

     -offline export option below for more info).  To avoid any ambiguity, use

     of the -fs export option is recommended (see below).


     The second component of a line specifies how the file system is to be

     exported to the host set.  The option flags specify whether the file sys-

     tem is exported read-only or read-write and how the client uid is mapped

     to user credentials on the server.


     Export options are specified as follows:


     -maproot=user The credential of the specified user is used for remote

     access by root.  The credential includes all the groups to which the user

     is a member on the local machine ( see id(1) ). The user may be specified

     by name or number.


     -maproot=user:group1:group2:... The colon separated list is used to spec-

     ify the precise credential to be used for remote access by root.  The

     elements of the list may be either names or numbers.  Note that ``user:''

     should be used to distinguish a credential containing no groups from a

     complete credential for that user.


     -mapall=user or -mapall=user:group1:group2:... specifies a mapping for

     all client uids (including root) using the same semantics as -maproot.


     The option -r is a synonym for -maproot in an effort to be backward com-

     patible with older export file formats.


     In the absence of -maproot and -mapall options, remote accesses by root

     will result in using a credential of -2:-2.  All other users will be

     mapped to their remote credential.  If a -maproot option is given, remote

     access by root will be mapped to that credential instead of -2:-2.  If a

     -mapall option is given, all users (including root) will be mapped to

     that credential in place of their own.


     The -alldirs flag allows the host(s) to mount at any point within the

     file system, including regular files if the -R option is used on nfsd.


     The -ro option specifies that the file system should be exported read-

     only (default read/write).  The option -o is a synonym for -ro in an

     effort to be backward compatible with older export file formats.


     The -32bitclients option causes the NFS server to guarantee that direc-

     tory cookies will fit within 32 bits even though directory cookies are 64

     bits in NFSv3.  This option may be required with NFS clients that do not

     properly support 64 bit directory cookies.  Use of this option may result

     in sub-optimal performance of the exported file system.


     The -manglednames option causes the NFS server to guarantee that file-

     names will fit into 255 bytes. For NFSv2 this is always the case. For

     NFSv3 specifying this option on an export will cause filenames greater

     than 255 characters from that export be mangled in such a way that when

     the client presents a received mangled name it will refer to the same

     name as the original name on the server.


     -sec=mechanism1:mechanism2... This option specifies one or more security

     mechanisms required for access to the exported directory.  The security

     mechanisms currently supported are krb5p, krb5i, krb5, and sys.  Multiple

     security mechanisms can be specified as a colon separated list, and

     should be in the order of most preferred to least preferred.  In the

     absence of this option, the security mechanism defaults to sys.


     -offline This option specifies that the given export should be treated as

     if the exported file system is not available.  For NFSv3, this will cause

     clients to receive "jukebox" errors directing them to try the request

     later.  For NFSv2 (which does not support this error value), the export

     will be treated as non-existent and clients will receive stale file han-

     dle errors.


     -fspath=/path and/or -fsuuid=UUID These options can be used to specify

     the pathname to and/or the UUID of the file system that is intended to be

     exported.  This can be useful to disambiguate the export entry.  Since

     the export syntax only specifies the path to the directory to be

     exported, it can be ambiguous as to what file system is expected to be

     exported.  Specifying "/Volumes/XRAID" can be interpreted as exporting

     either a file system mounted on that directory or the "Volumes/XRAID"

     subdirectory of the root file system.  Specifying -fspath=/Volumes/XRAID

     can prevent exporting the wrong file system - for example, if the exports

     are evaluated at a point when the directory exists but the volume has not

     yet been mounted on it.  The export will fail if the file system referred

     to in an export entry either (1) is not mounted at the same path as the

     given -fspath=/path.  or (2) does not have a UUID that matches the given

     -fsuuid=UUID.


     The third component of a line specifies the host set to which the line

     applies.  The set may be specified in three ways.  The first way is to

     list the host name(s) separated by white space.  (Standard internet IPv4

     ``dot'' addresses or IPv6 colon addresses may be used in place of names.)

     The second way is to specify a ``netgroup'' as defined in the netgroup

     file (see netgroup(5) ). The third way is to specify an internet sub-net-

     work using a network and network mask that is defined as the set of all

     hosts with addresses within the sub-network.  This latter approach

     requires less overhead within the kernel and is recommended for cases

     where the export line refers to a large number of clients within an

     administrative sub-net.


     The first two cases are specified by simply listing the name(s) separated

     by whitespace.  All names are checked to see if they are ``netgroup''

     names first and are assumed to be hostnames otherwise.  Using the full

     domain specification for a hostname can normally circumvent the problem

     of a host that has the same name as a netgroup.  The third case is speci-

     fied by the flag -network=netname and optionally -mask=netmask.  If the

     mask is not specified, it will default to the mask for that network class

     (A, B or C; see inet(5) ).


EXAMPLES

           /usr /usr/local -maproot=0:10 friends

           /usr -maproot=daemon grumpy.cis.uoguelph.ca 131.104.48.16

           /usr -ro -mapall=nobody

           /u -maproot=bin: -network 131.104.48 -mask 255.255.255.0

           /u1 -alldirs -network 2001:DB8:: -mask ffff:ffff::

           /u2 -maproot=root friends

           /u2 -alldirs -network cis-net -mask cis-mask

           /Users -alldirs -network 2.29.96.0 -mask 255.255.255.0

           /Applications -ro -network 2.29.96.0 -mask 255.255.255.0


     Given that /usr, /u, /u1, /u2, and / are local file system mount points,

     the above example specifies the following:


     /usr is exported to hosts friends, where friends is specified in the net-

     group file with users mapped to their remote credentials and root mapped

     to uid 0 and group 10.  It is exported read-write and the hosts in

     friends can mount either /usr or /usr/local.  It is exported to

     131.104.48.16 and grumpy.cis.uoguelph.ca with users mapped to their

     remote credentials and root mapped to the user and groups associated with

     ``daemon''; it is exported to the rest of the world as read-only with all

     users mapped to the user and groups associated with ``nobody''.


     /u is exported to all hosts on the sub-network 131.104.48 with root

     mapped to the uid for ``bin'' and with no group access.


     /u1 is exported to all hosts on the IPv6 sub-network 2001:DB8::


     /u2 is exported to the hosts in ``friends'' with root mapped to uid and

     groups associated with ``root''; it is exported to all hosts on network

     ``cis-net'' allowing mounts at any directory within /u2.


     The /Users and /Applications sub-directories of / are exported to all

     hosts on the sub-network 2.29.96.  Any directory within /Users can be

     mounted.  /Users is exported read-write and /Applications is exported

     read-only.


     FILES

     /etc/exports  The default remote mount-point file.


SEE ALSO

     netgroup(5), nfsd(8), showmount(8) portmap(8)


BUGS

     It is recommended that all exported directories within the same server

     file system be specified on adjacent lines going down the tree.  You can-

     not specify a hostname that is also the name of a netgroup.  Specifying

     the full domain specification for a hostname can normally circumvent the

     problem.


读不懂英文的朋友,只需关注其中的例子就可以了,按照例子就能成功在MacOSX上配置成NFS文件共享。


本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

MacOSX上的NFS文件共享 的相关文章

  • 8、docker+k8s+kubesphere:nfs安装(2020-08-02更新)

    8 docker 43 k8s 43 kubesphere nfs安装 server端安装在node151 yum y span class token function install span nfs utils rpcbind 配置文
  • NFS与自动挂载

    1 NFS共享文件server端的配置 xff08 server ip xff1a 172 16 8 11 xff09 root 64 localhost getenforce Enforcing root 64 localhost set
  • 利用NFS服务挂载NFS根文件系统

    嵌入式Linux根文件系统 xff0c 简单地说 xff0c 根文件系统就是一种目录结构 注意根文件系统和普通的文件系统的区别 常见的Linux根文件系统有 xff1a xff08 1 xff09 NFS xff08 网络根文件系统 xff
  • [linux]mount与nfs挂载简介

    文章目录 挂载mount目录间挂载卸载与fuserfstabNFS Server配置命令 NFS client mount用于挂载设备 xff1a 挂载分区 xff1a mount dev sdb1 data xff1b 文件夹间 xff1
  • Linux安装配置NFS服务器

    目录 NFS简介 安装NFS服务 网络环境配置 开发板挂载NFS 常见问题 NFS简介 NFS network file system 即网络文件系统 能使使用者访问网络上别处的文件就像在使用自己的计算机一样 我们可以在 Ubuntu 上制
  • 【ubuntu】nfs服务搭建

    一 开篇 在嵌入式linux开发过程中 由于目标平台的资源限制 开发环境一般都不会放到目标板卡上 需要放在开发宿主机上 如果需要宿主机与目标板卡之间进行文件传输 该怎么办呢 这时候nfs就派生用场了 nfs Network File Sys
  • 使用nfs实现目录共享

    准备两台虚拟机 其中一台为主端 另一台为备用端 1 安装nfs及其依赖包 两台虚拟机都要安装 yum install y nfs utils rpcbind id nobody 查看nfsnobody用户是否存在 systemctl sta
  • NFS 高可用方案(NFS+keepalived+Sersync)

    NFS 高可用方案 NFS keepalived Sersync 1 简述 1 1 介绍 本方案 NFS 的高可用方案 应用服务器为 Client 两台文件服务器分别Master和 Slave 使用 keepalived 生成一个虚拟 IP
  • Ubuntu小技巧9--使用Samba服务实现Windows和Linux文件访问

    Ubuntu小技巧8 Ubuntu小技巧9 使用Samba服务实现Windows和Linux文件访问 很多时候做开发的时候需要在Linux上编译运行 但是又想用Windows的优秀工具 不停的将文件拷贝到Windows和Linux是极其浪费
  • ubuntu下nfs服务安装

    操作系统 ubuntu22 04 2 一 服务端安装与配置 1 在服务端安装nfs服务端组件 sudo apt install nfs kernel server 2 创建共享目录share并且授权所有人可以访问 sudo mkdir sh
  • openwrt调试用到的

    PC间文件共享 python3 m http server 在共享的电脑上 打开浏览器 直接输入 serverip 8000 NFS Ubuntu PC端 sudo apt get install nfs kernel server sud
  • nfs漏洞的处理:目标主机showmount -e信息泄露(CVE-1999-0554)

    文章目录 前言 一 漏洞内容 二 配置现状 1 nfs server节点 etc exports文件的配置 2 client节点执行showmount e 测试 三 nfs server节点增加访问控制的配置 1 etc hosts all
  • 安装配置nfs服务

    NFS的功能 让不同操作系统之间可以互传文件 Server端 Server端可以关闭防火墙 或放行nfs服务 systemctl stop firewalld 临时关闭防火墙 systemctl disable firewalld 开机自动
  • Vagrant 错误:无法在 Linux 来宾中挂载文件夹

    我对 Vagrant 共享文件夹有一些问题 我的基本系统是 Ubuntu 13 10 桌面 我不明白为什么我会出现此错误 是配置不正确吗 是 NFS 问题还是 Virtualbox Guest Additions 问题 我尝试过使用不同的许
  • 将单个文件从 NFS docker 卷挂载到容器中

    示例 为简洁起见 省略了许多选项 version 3 volumes traefik driver local driver opts type nfs o addr 192 168 1 100 soft rw nfsvers 4 asyn
  • WSL 下的 NFS 客户端 - mount.nfs:没有此类设备

    我在尝试挂 载 nfs 导出时收到以下错误 sudo mount 192 168 1 175 mnt nas mnt c nas mount nfs No such device 有想法该怎么解决这个吗 截至 2020 年 10 月 您可以
  • openEuler NFS多路径

    简介 网络文件系统 NFS 是一种分布式文件系统协议 最初由 Sun Microsystems Sun 于 1984 年开发 允许NFS客户端上的用户通过计算机网络访问NFS服务端上文件 随着NFS服务广泛应用于金融 EDA AI 容器等行
  • 通过 NFS 共享文件夹对 VirtualBox 上的 Hack 代码进行类型检查

    首先提到的似乎是谨慎的这个问题 https github com facebook hhvm issues 2311进而这个恰如其名的编辑 https github com facebook hhvm commit 3f8842fab404
  • nfsnobody 用户权限

    我已经在两台 CentOS 6 64 机器之间设置了 NFS 文件共享 在服务器上 共享的文件夹最初由 root 用户拥有 在客户端上 它显示为 nfsnobody 所有 当我尝试从客户端写入该文件夹时 出现权限错误 因此 我将服务器上的文
  • 如何确保与 sqlite 和 NFS 的文件安全同步

    我最近将应用程序的工作区文件格式转换为 sqlite 为了确保 NFS 上的稳健操作 我使用了通用更新策略 对本地硬盘上临时位置中存储的副本进行了所有修改 仅在保存时 我才会通过使用临时文件复制原始文件来修改原始文件 可能在 NFS 上 我

随机推荐

  • 用Go语言开发以太坊合约

    转发请注明出处 https blog csdn net ahy231 article details 114112638 序 网上关于 go 语言开发 DApp 的教程较少 因此我只能通过官方文档来系统学习 go 语言的 DApp 开发 这
  • MacOS13+系统运行Stable Diffusion出现的问题及解决方法汇总

    目录 先睹为快 开发环境 问题一 点 生成 按钮就退出程序 问题二 生成的图片是马赛克 第一步 解决环境问题 第二步 更新指定的torch版本包 步骤一 更新指定的torch包 步骤二 重新安装pytorch nightly版本的包 问题三
  • 解决虚拟机VM和WSL2切换问题

    操作环境 windows11 虚拟机 wsl2用的都是Ubuntu 18 04 问题描述 因为之前一直使用wsl2 很久没有使用VM虚拟机 今天打开的时候发现VM不能用了 于是查资料发现用VM和wsl2会冲突 解决办法 首先说一下怎么从之前
  • C和C++中字符串说明与记录

    文章目录 目的 C语言 字符基本说明 字符串声明与操作 字符串常用函数说明 属性 复制 合并 替换 查询 比较 类型检查 类型转换 C C 字符串基本说明 C string和C语言字符串转换 C string常用方法说明 属性 类型转换 修
  • flutter滚动Text文本

    GlobalKey scrollTextKey new GlobalKey Timer scrollTextTimer ScrollController controller int index 0 override void initSt
  • js实现首页图片的轮播效果

    在大多数的网站里面首页都会有一个图片轮播的效果 而我们开发者要实现这种效果要么是使用第三方插件 要么是使用js自己写函数来实现这种效果 而我自己就是自己写js来实现这种效果 首先 我们来看一下最终完成的效果 这个就是最终实现的效果 下面我们
  • Qt5.0+msvc2010:解決中文乱码的问题

    1 在Qt Creator的工具列 选择 工具 gt 选项 进入设置界面 2 在弹出的设置界面里面 选择 文本编辑器 选择 行为 选项卡 把 行为 选项卡下面的 默认编码 置成 UTF 8 同时 UTF 8 BOM 置成 总是删除 最后点
  • MySQL(69)MySQL查看视图

    MySQL查看视图 创建好视图后 可以通过查看视图的语句来查看视图的字段信息以及详细信息 本节主要讲解如何使用 SQL 语句来查看视图的字段信息以及详细信息 查看视图的字段信息 查看视图的字段信息与查看数据表的字段信息一样 都是使用 DES
  • docker安装fastdfs

    1 搜索fastdfs docker search fastdfs 2 拉取镜像 docker pull morunchang fastdfs 3 运行tracker docker run d name tracker net host m
  • Gerrit 使用git常见问题

    目录 git push 失败报错 remote rejected master gt master prohibited by Gerrit git push报错 ERROR missing Change Id in message foo
  • Android Logcat&debug实用技巧

    logcat 作为我们最常用的调试手段 相信大家都不会陌生 这里总结一下 在使用Logcat过程中 常用的一些debug技巧 目的是为了快速有效的帮助找到并解决问题 先来看一看Logcat打印结构 常用 logcat v threadtim
  • 网上投稿地址大全

    网上投稿地址大全 上海科技报 kgbshen online sh cn 厂长经理日报 cjb490 sina com 四川日报 sichuandaily scol com cn 四川农村日报 country scol com cn 华西都市
  • MATLAB线性规划相关函数用法

    一 线性规划的Matlab标准形式及软件求解 1 MATLAB中规定线性规划的标准形式为 其中c和 x为n 维列向量 A Aeq 为适当维数的矩阵 b beq为适当维数的列向量 Aeq 对应约束条件中等式约束的系数矩阵 A为约不等式约束的系
  • 保姆级Mycat操作详解

    Mycat环境搭建 下载 http dl mycat org cn 2 0 上传到虚拟机并解压 tar zxvf mycat tar gz cd mycat ll 授权 设置mycat权限 chmod R 777 mycat 环境变量 配置
  • ubuntu 下 linux 2.6.18.tar.gz 内核编译,Ubuntu安装Linux2.6.35内核编译

    Ubuntu12 04 参考 百度 在ubuntu安装Linux2 6 35内核 https www linuxidc com Linux 2011 08 40124 htm http www mamicode com info detai
  • 教资高中信息技术 倒数第四天

    第一天 过教材 因为 时间紧张 大部分简写 用于复习 总结 1信息的基本特征 普传功夫真驾驶 2信息技术发展阶段 语文印电计 3人类获取信息途径 直接 间接 4搜索引擎 全文 目录 元 5信息管理过程 信息采集 加工 储存 编码 6人工智能
  • upload-labs通关记录

    upload labs源码地址 https github com c0ny1 upload labs upload labs Pass 1 js检查 Pass 2 只验证Content type Pass 3 黑名单绕过 Pass 4 ht
  • 算法的改进让刷脸核验在极短时间内完成

    刷脸支付系统是一款基于人脸识别系统的支付平台 该系统无需钱包 卡或手机 会自动将消费者面部信息与个人账户相关联 支付时只需要面对设备屏幕上的摄像头即可 整个交易过程 便捷 传统的支付方式 需要把卡 现金 手机等作为介质 但一旦忘记带现金 手
  • STM32与HC-SR04超声波测距

    首先 先来看一下这个模块的基本功能和原理 HC SR04超声波测距模块可提供2cm 400cm的非接触式距离感测功能 测距精度可达高到3mm 模块包括超声波发射器 接收器与控制电路 像智能小车的测距以及转向 或是一些项目中 常常会用到 智能
  • MacOSX上的NFS文件共享

    在MacOSX上接触过rsync方式文件共享和NFS方式文件共享 两种方式的基本使用方式如下 1 rsync方式 这种方式和scp用法很像 rsync file1 user host xx file2 如果传输目录 需要加一个 a参数 如果