Library Table of Contents Index Previous Next Comments

Reverting a file to a selected snapshot

About snap restore file reversion  Top

The use of snap restore to revert a single file to a selected snapshot is practical when the size of the file is so large that you cannot copy the previous file version from the snapshot to the active file system.

Some notes concerning snap restore file reversion:

How to revert a file  Top

To revert a single file (rather than a volume), complete the following steps.

Note
To cancel file reversion, press Ctrl-C at any time before you press y in Step 10.

Step

Action

1

Notify network users that you are going to revert a file so that they know that the current data in the file will be replaced by that of the selected snapshot.

Note
NFS users who try to access a reverted file without first reopening it might get a "stale file handle" error message after the volume reversion.

2

If...

Then...

You know the name of the snapshot for reverting the file you want to revert

Go to Step 6.

You want to choose a snapshot from the list of snapshots available for reversion

Go to Step 3.

3

Enter the following command:

snap restore [-f] [-t file] [-r restore_as_new_path] 
path_and_file_name

options can be one or more of the following:

-f suppresses the warning message and the prompt for confirmation.

-t file specifies that you are entering the name of a file to revert.

-r restore_as_new_path restores the file to a location different from (but in the same volume as) the location in the snapshot. For example, if you specify /vol/vol0/vol3/myfile as the argument to -r, SnapRestore reverts the file called myfile to the location /vol/vol0/vol3 instead of to the path in vol3 indicated by path_and_file_name.

path_and_file_name is the complete path to the name of the file to be reverted. You can enter only one path name.

A file can be restored only to the volume where it was originally. The directory structure to which a file is to be restored must be the same as specified in the path. If this directory structure no longer exists, you must recreate it before restoring the file.

Result

Data ONTAP displays a warning message and prompts you to confirm your decision to revert the file.

4

Press y to confirm that you want to revert the file.

Result

Data ONTAP displays a list of snapshots.

5

Enter the name of the snapshot for reverting the file, then go to Step 8.

Result

Data ONTAP displays the name of the file to revert and the name of the snapshot to be used for the reversion.

6

Enter the following command:

snap restore[-f] [-t file] -s snapshot_name
[-r restore_as_path] path_and_file_name

options can be one or more of the following:

-f suppresses the warning message and the prompt for confirmation.

-t file specifies that you are entering the name of a file to revert.

-s snapshot_name specifies the name of the snapshot from which to revert the data.

-r restore_as_path restores the file to a location different from the location in the snapshot. For example, if you specify /vol/vol0/vol3/myfile as the argument to -r, SnapRestore reverts the file called myfile to the location /vol/vol0/vol3 instead of to the file structure indicated by the path in path_and_file_name.

path_and_file_name is the complete path to the name of the file to be reverted. You can enter only one path name.

A file can be restored only to the volume where it was originally. The directory structure to which a file is to be restored must be the same as specified in the path. If this directory structure no longer exists, you must recreate it before restoring the file.

Unless you enter -r and a path name, only the file at the end of the path_and_file_name is reverted. You can enter only one path name.

Result

If you have not used the -f option, Data ONTAP displays a warning message and prompts you to confirm your decision to revert the file.

7

Press y to confirm that you want to revert the file.

Result

Data ONTAP displays the name of the file and the name of the snapshot for the reversion and, if you have not used the -f option, prompts you to decide whether to proceed with the reversion.

8

If...

Then...

You want to continue with the reversion

Press y.

Result

The filer reverts the file from the selected snapshot.

You do not want to proceed with the reversion

Press n or Ctrl-C.

Result

The file is not reverted and you are returned to a filer prompt.

Example
filer> snap restore -t file /vol/vol1/users/jim/myfile 
-s nightly.0

 
filer> WARNING! This will restore a file from a snapshot into the 
active filesystem.  If the file already exists in the active 
filesystem, it will be overwritten with the contents from the 
snapshot.
Are you sure you want to do this? y

 
You have selected file /vol/vol1/users/jim/myfile, snapshot 
nightly.0
Proceed with restore? y
Result

Data ONTAP restores the file called myfile to the existing volume and directory structure /vol/vol1/users/jim.

Example
filer> snap restore -t file -s nightly.0
-r /vol/vol2/archive/eng/myfile /vol/vol2/users/jim/myfile

 
filer> WARNING! This will restore a file from a snapshot into the 
active filesystem.  If the file already exists in the active 
filesystem, it will be overwritten with the contents from the 
snapshot.
Are you sure you want to do this? y

 
You have selected file /vol/vol1/users/jim/myfile, snapshot 
nightly.0
Proceed with restore? y
Result

Data ONTAP restores the file called myfile to a new location at /vol/vol2/archive/eng.

After a file has been reverted with SnapRestore, all user-visible information (data and file attributes) for that file in the active file system is identical to that contained in the snapshot.

Library Table of Contents Index Previous Next Comments