Restore a file from a snapshot using a client with Azure NetApp Files
Snapshots enable point-in-time recovery of volumes. If you do not want to restore the entire snapshot to a volume, you have the option to restore a file from a snapshot by using a client that has the volume mounted.
The mounted volume contains a snapshot directory named
.snapshot (in NFS clients) or
~snapshot (in SMB clients) that is accessible to the client. The snapshot directory contains subdirectories corresponding to the snapshots of the volume. Each subdirectory contains the files of the snapshot. If you accidentally delete or overwrite a file, you can restore the file to the parent read-write directory by copying the file from a snapshot subdirectory to the read-write directory.
You can control access to the snapshot directories by using the Hide Snapshot Path option. This option controls whether the directory should be hidden from the clients. Therefore, it also controls access to files and folders in the snapshots.
NFSv4.1 does not show the
.snapshot directory (
ls -la). However, when the Hide Snapshot Path option is not set, you can still access the
.snapshot directory via NFSv4.1 by using the
cd <snapshot-path> command from the client command line.
Restore a file by using a Linux NFS client
lsLinux command to list the file that you want to restore from the
$ ls my.txt
ls: my.txt: No such file or directory
$ ls .snapshot
$ ls .snapshot/hourly.2020-05-15_1306/my.txt
cpcommand to copy the file to the parent directory.
$ cp .snapshot/hourly.2020-05-15_1306/my.txt .
$ ls my.txt
Restore a file by using a Windows client
~snapshotdirectory of the volume is hidden, show hidden items in the parent directory to display
Navigate to the subdirectory within
~snapshotto find the file you want to restore. Right-click the file. Select Copy.
Return to the parent directory. Right-click in the parent directory and select
Pasteto paste the file to the directory.
You can also right-click the parent directory, select Properties, click the Previous Versions tab to see the list of snapshots, and select Restore to restore a file.