Table of ContentsView 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.

Before you begin

Ensure that you notify the network users before reverting 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.

About this task

When you use snap restore for file reversion, note the following information:

Steps

  1. As required, choose one of the actions from the following table:
    If... Then...
    You know the name of the Snapshot copy for the file you want to revert Go to Step 5.
    You want to choose a Snapshot copy from the list of Snapshot copies available for reversion Go to Step 2.
  2. Enter the following command:snap restore [-f] -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.

    You can restore a file 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 that specified in the path. If this directory structure does not exist, you must 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.
    Data ONTAP displays a warning message and prompts you to confirm your decision to revert the file.
  3. Press y to confirm that you want to revert the file.
    Data ONTAP displays a list of Snapshot copies.
  4. Enter the name of the Snapshot copy for reverting the file, then go to Step 8.
    Data displays the name of the file to revert and the name of the Snapshot copy to be used for the reversion.
  5. Enter the following command:snap restore [-f] -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.

    You can restore a file only to the volume where it was located 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 does not exist, you must 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.

    Note: Use the -f option to avoid warning messages and prompts that confirm your decision to revert the file. For more information, see the na_snap(1) man page.
  6. Press y to confirm that you want to revert the file.
    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.
  7. As required, choose one of the actions from the following table:
    If... Then...
    You want to continue with the reversion Press y.

    Result: The system reverts the file from the selected Snapshot copy.

    You do not want to continue with the reversion and want to choose another 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.

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