Table of ContentsLibraryView in Frames

Reverting a file to a selected Snapshot copy

Using snap restore to revert a single file to a selected Snapshot copy is practical when the file is so large that you cannot copy the previous file version from the Snapshot copy to the active file system.

Considerations

Some notes concerning snap restore file reversion:
  • You cannot use SnapRestore for single file reversion on files with NT streams, or on directories.
  • If you restore single files with the snap restore command, and then issue the snap list command, the snap list command might take up to several minutes to complete. You can minimize the amount of time required to complete by using the snap list -n command. For more details, see the manual (man) pages.
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 8.

Steps

  1. Notify the 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 copy.

    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 copy for reverting the file you want to revert Go to Step 6.
    You want to choose a Snapshot copy from the list of Snapshot copies available for reversion Go to Step 3.
  3. Enter the following command:snap restore -t file -r restore_as_new_path path_and_file_name

    -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 copy. 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 located. 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 re-create it before restoring the file.
    Note: Use the -f option to avoid warning messages and prompts to confirm your decision to revert the volume. For more information, see the na_snap(1) man page.
    Result: Data ONTAP displays a warning message and prompts you to confirm your decision to revert the file.

    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.

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

    Result: Data ONTAP displays a list of Snapshot copies.

  5. Enter the name of the Snapshot copy 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 copy to be used for the reversion.

  6. Enter the following command:snap restore -t file -s snapshot_name -r restore_as_path path_and_file_name

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

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

    -r restore_as_path restores the file to a location different from the location in the Snapshot copy. 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 re-create 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 copy 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 storage system reverts the file from the selected Snapshot copy.

    You want to choose a Snapshot copy from the list of Snapshot copies available for reversion Press n or Ctrl-C.

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

Example

system> snap restore -t file /vol/vol1/users/jim/myfile -s nightly.0
system> WARNING! This will restore a file from a snapshot into the active file system. If the file already exists in the active file system, 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
system>snap restore -t file -s nightly.0 -r /vol/vol2/archive/eng/myfile /vol/vol2/users/jim/myfile 

system>WARNING! This will restore a file from a snapshot into the active file system. If the file already exists in the active file system, 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 copy.

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