Why isn't the .snapshot directory visible in an 'ls -al' output on an NFS client?
Applies to
ONTAP 9
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.
[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