跳转到主内容

硬挂载和软挂载有什么区别

Views:
890
Visibility:
Public
Votes:
7
Category:
ontap-9
Specialty:
nas
Last Updated:

适用于

  • NFS
  • NAS 协议

问题解答

硬安装和软安装的区别

使用 NFS 协议,NFS 客户端可以挂载存在于 NFS 服务器上的文件系统,就像本地文件系统一样。

例如,您可以将 host.server.com 的 "/home" 目录挂载到您的客户端计算机,如下所示:

# mount host.server.com:/home /mymountpoint

目录 “/mymountpoint” 应在您的计算机中创建以保存 NFS 分区。
硬装载或软装载选项定义了 NFS 客户端应如何处理 NFS 服务器崩溃/故障。

硬挂载
  • 硬装载通常用于块资源,例如本地磁盘或 SAN。当 NFS 文件系统挂载是硬挂载时,会重复发出影响挂载资源任何部分的 NFS 请求,直到请求得到满足(例如,服务器崩溃并在稍后恢复)。
  • 一旦服务器恢复联机,程序将继续从服务器崩溃期间的状态不受干扰地执行。我们可以使用挂载选项 "intr",该选项允许在服务器停机或无法访问时中断 NFS 请求。因此,推荐的设置是硬设置和 intr 选项。

优点

  • 如果连接丢失,所有 NFS 客户端将冻结,直到 NFS 服务器恢复联机为止。因此,不会丢失数据。
  • 数据完整性和消息传递得到保证。

缺点:

  • 常量连接可能会影响性能。

从远程计算机 host.server.com 硬挂载目录 /home 到挂载点 /mymountpoint 的命令。rw - 用于将资源挂载为可读写,intr - 用于启用键盘中断。 

mount -o rw,hard,intr host.server.com/home /mymountpoint

软挂载

软装载通常用于网络文件协议,例如 NFS 或 CIFS。当 NFS 文件系统装载是软装载时,程序或应用程序从 NFS 文件系统请求文件,NFS 客户端守护程序将尝试从 NFS 服务器检索数据。NFS 会反复尝试联系服务器,直到:

  • 已建立连接
  • 已达到 NFS 重试阈值
  • 已达到 nfstimeout 值

如果发生这些事件之一,控制将返回到调用程序。
但是,如果没有收到来自 NFS 服务器的任何响应(由于 NFS 服务器的任何崩溃、超时或故障),则 NFS 客户端将向请求文件访问的客户端计算机上的进程报告错误,然后退出。

警告

除非应用程序供应商明确建议使用软挂载,否则由于可能造成数据损坏,不建议使用此挂载方式。 

优点

  • 此机制的优点是"快速响应",因为它不会等待 NFS 服务器的响应。
  • 如果 NFS 服务器不可用,内核将在预配置的时间段后超时 I/O 操作。

缺点:

  • 缺点是,如果您的 NFS 驱动程序缓存数据并且软装载超时,则应用程序可能不知道哪些对 NFS 卷的写入实际上已提交到磁盘。
  • 数据损坏或数据丢失。

从远程计算机 host.server.com 在挂载点上软挂载的命令 /mymountpoint

mount -o rw,soft host.server.com/home /mymountpoint

要检查系统上当前存在的挂载类型:

[usero1@Linux01 ~]$ nfsstat -m

/home from vrouter:/home
Flags: rw,relatime,vers=4.1,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr= 10.0.0.1,local_lock=none,addr=10.0.0.2
/mnt/test from svm-data-lif1:/vol_unix
Flags: rw,relatime,vers=4.0,rsize=65536,wsize=65536,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr= 10.0.0.1,local_lock=none,addr=10.0.0.2

追加信息

additionalInformation_text

 

NetApp provides no representations or warranties regarding the accuracy or reliability or serviceability of any information or recommendations provided in this publication or with respect to any results that may be obtained by the use of the information or observance of any recommendations provided herein. The information in this document is distributed AS IS and the use of this information or the implementation of any recommendations or techniques herein is a customer's responsibility and depends on the customer's ability to evaluate and integrate them into the customer's operational environment. This document and the information contained herein may be used solely in connection with the NetApp products discussed in this document.