跳转到主内容

硬挂载与软挂载有何区别

Views:
785
Visibility:
Public
Votes:
6
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请求。因此、建议的设置为hard和intr选项。

优势

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

缺点

  • 持续连接可能会影响性能。

用于从mount-point /mymountpoint 上的远程计算机host.server.com硬挂载目录/home命令。RW–表示挂载的资源为读写,intr–表示启用了键盘中断。 

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

软安装

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

  • 已建立连接
  • 已达到NFS重试阈值
  • 已达到nfst获得 值

如果发生其中一个事件,控件将返回到调用程序。
但是、如果由于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

追加信息

其他信息文本

 

 

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.