Skip to main content
NetApp Knowledge Base

Why isn't the .snapshot directory visible in an 'ls -al' output on an NFS client?

Views:
10,277
Visibility:
Public
Votes:
8
Category:
ontap-9
Specialty:
nas
Last Updated:

Applies to

  • ONTAP 9
  • NFS

Answer

  • The following must be true for the .snapshot to appear in an 'ls -la' output.
  • The filer must be mounted via NFSv3
  • NFSv4 will never show the .snapshot directory
  • However the .snapshot directory is still accessible via NFSv4
  • The ls -al command must be executed from the base of the mount point
  • The snapshot directory must be enabled on the volume
  • This is controlled via the snapdir-access flag on the volume

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

  • The v3-hide-snapshot option must be disabled
     
Introduced in ONTAP 9.5


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

Additional Information

  • Example:
    • 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
  • No .snapshot directory is seen, however, it can still be accessed.
  • Virtualization platforms such as VMware will also not list this directory.

[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.