跳转到主内容

为什么.Snapshot目录在NFS客户端的"ls -al"输出中不可见?

Views:
117
Visibility:
Public
Votes:
0
Category:
ontap-9
Specialty:
nas
Last Updated:

适用场景

  • ONTAP 9
  • NFS

问题解答

要使 .snapshot 出现在“ls -la”输出中:

  • 必须通过 NFSv3 安装导出。

注意: NFSv4 永远不会显示.snapshot目录(协议标准),但仍然可以访问。

  • ls -al必须从挂载点的根目录执行该命令。
  • 必须在卷上启用快照目录: 

::> volume show -volume nfs_vol -fields snapdir-access
vserver volume snapdir-access
------- ------- --------------
vserver nfs_vol true

  • 必须禁用 v3-hide-snapshot 选项(ONTAP 9.5+):

::> vserver nfs show -vserver sinanju -fields v3-hide-snapshot
vserver v3-hide-snapshot
------- ----------------
vserver disabled

 

追加信息

示例
  • NFSv3

[root@centos ~]# mount -t nfs -o vers=3 10.216.29.104:/nfs_vol /mnt/nfs3
[root@centos ~]# ls -al /mnt/nfs3
total 12
drwxrwxrwx. 2 root root 4096 Apr 17 2019 .
drwxr-xr-x. 43 root root 4096 Oct 17 16:16 ..
drwxrwxrwx. 12 root root 4096 Oct 17 16:05 .snapshot
-rw-r--r--. 1 root root 0 Apr 17 2019 test.log
[root@centos ~]# ls -al /mnt/nfs3/.snapshot
total 48
drwxrwxrwx. 12 root root 4096 Oct 17 19:05 .
drwxrwxrwx. 2 root root 4096 Apr 17 2019 ..
drwxrwxrwx. 2 root root 4096 Apr 17 2019 daily.2019-10-16_0010
drwxrwxrwx. 2 root root 4096 Apr 17 2019 daily.2019-10-17_0010
drwxrwxrwx. 2 root root 4096 Apr 17 2019 hourly.2019-10-17_1305

  • NFSv4
  • 未看到任何.snapshot 目录、但仍可访问它。
  • VMware等虚拟化平台也不会列出此目录。

[root@centos ~]# mount -t nfs -o vers=4 10.216.29.104:/nfs_vol /mnt/nfs4
[root@centos ~]# ls -al /mnt/nfs4
total 8
drwxrwxrwx. 2 nobody nobody 4096 Apr 17 2019 .
drwxr-xr-x. 43 root root 4096 Oct 17 16:16 ..
-rw-r--r--. 1 nobody nobody 0 Apr 17 2019 test.log
[root@centos ~]# ls -al /mnt/nfs4/.snapshot
total 48
drwxrwxrwx. 12 nobody nobody 4096 Oct 17 18:05 .
drwxrwxrwx. 2 nobody nobody 4096 Apr 17 2019 ..
drwxrwxrwx. 2 nobody nobody 4096 Apr 17 2019 daily.2019-10-16_0010
drwxrwxrwx. 2 nobody nobody 4096 Apr 17 2019 daily.2019-10-17_0010
drwxrwxrwx. 2 nobody nobody 4096 Apr 17 2019 hourly.2019-10-17_1205

 

 

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.