Restoring a File or Directory

Prev Next

Each snapshot is accessible as a directory nested under a hidden dedicated .snapshot directory inside the directory backed up by the snapshot.

For example, a snapshot of the directory /MyDirectory, named MySnapshot is stored at /MyDirectory/.snapshot/MySnapshot. The directory MyDirectory/.snapshot/MySnapshot contains a read-only backup of all files and directories that were contained in /MyDirectory at the time the snapshot was created.

You can also choose an option in each view policy to make .snapshot directories accessible in every directory. In subdirectories of protected paths, these .snapshot directories will provide links to any existing snapshots of parent directories, even if there is no protected path on the subdirectory itself. This provides easier access from each directory to snapshots of parent directories.

You can restore a file or directory by copying it from the snapshot.

Restoring Files from Linux Clients (NFS)

  1. Open a connection to an NFS client host machine that is allowed to access the export containing the snapshot, or run such a machine locally.

  2. (Optional) To view snapshots of a directory or to view the files and directories contained in a snapshot, use the ls command.

    Examples:

    • The following command displays snapshots of the export mounted on the local directory /MyDirectory.

      ls /MyDirectory/.snapshot
      
    • The following command displays the contents of a snapshot (named MySnapshot) of the export mounted on the local client directory /MyDirectory:

      ls /MyDirectory/.snapshot/MySnapshot

    Note

    Running the ls command even with the -a option to list all contents of the original directory will not reveal the .snapshot directory, since it is hidden.

    Note

    Specify the local path on the client machine, using the name of the local directory on which the export is mounted, which may be different from the export's name.

  3. Copy the file or directory to the original directory, using one of the following:

    • cp for local copy. Add the -p flag to preserve the file's owner, ACL and timestamp.

      For example, the following command copies the file MyFile from the snapshot MySnapshot to a destination file of the same name in the original directory MyDirectory:

      cp -p MyDirectory/.snapshot/MySnapshot/Myfile MyDirectory/MyFile

      If the file had been deleted from the original directory, this command will restore the file by creating the file and copying the backed up file content to the newly created file. If the file had been changed and not deleted, this command will overwrite the changed file with the backup version from the snapshot.

    • scp for remote copy. Again, use the -p flag to preserve the file's owner, ACL and timestamp.

    • rsync for remote fast copy, especially useful for large files and directories. Add the -A flag to preserve the file's owner, ACL and timestamp.

Restoring Files from SMB Clients

You can restore files on an SMB Client from a VAST snapshot, or from Previous Versions in Windows Explorer.

Restoring Files from Snapshots

Since the .snapshots directory is a hidden directory, it is accessible the same way as any hidden directory. It may not normally appear by default in an application such as the Windows File Explorer, but you can access it the same way you can access any hidden directory, such as:

  1. On the client machine, open File Explorer and browse to the drive that is mapped to the SMB share.

  2. Click inside the address bar, and type in the full path to the snapshots directory. For example, if you have mapped the share to drive Z, then enter Z:\.snapshot.

  3. Press ENTER on your keyboard or click the Go to button by the address bar.

    The .snapshot directory opens.

    You can now restore a file in the original directory by simply copying the file from the .snapshot directory, navigating to the location where you want to restore the file, and pasting.

Restoring SMB Previous Versions from Windows Explorer

You can restore previous versions of a file or directory using Windows Previous Versions. Previous versions use VAST snapshots of the source file or directory.

You can use Windows Explorer to view a list of all previous versions, review information about each of them, and restore a previous version from the list.

Note

Non-Windows SMB users (Mac, Linux) can access previous versions of files and directories by configuring their view policy to make the .snapshot folder visible in all directories instead of limiting its visibility to the parent protected path.Creating View Policies

Restore Considerations

The following needs to be taken into account when restoring a previous version:

  • Symbolic links are restored as regular files. Directory symbolic links are not restored.

  • If the current version of a directory contains files or subdirectories that do not exist in the version being restored, these files or subdirectories are not deleted during the restore.

  • The restore is not allowed if any of the files to be overwritten during the restore have S3 object locks.

Handling of Permissions on Access and Restore

An SMB client is allowed to access or restore a previous version of a file or directory if the SMB client user has permissions to access both current and previous versions of the file or directory.

After restore is complete, the SMB client user is the owner of the restored file or directory, with ACLs and permissions set to default. Any settings made specifically for a previous version are not kept. If needed, you can manually copy the ACLs from the previous version.

Enabling and Configuring SMB Previous Versions

Support for previous versions is a built-in feature of the SMB protocol on VAST Cluster. No additional steps on the VAST cluster are needed to enable or configure this feature.

Restoring Data from a Snapshot as S3 Objects  

To restore data using S3, use a CopyObject request to copy the data as objects from its location under the .snapshot directory to the location where you want to restore the data.

For example, using the s3cmd S3 client, you can use the cp command to invoke such a request:  

$ s3cmd -c vast.s3cfg cp s3://mybucket/.snapshot/mysnapshot/myobject s3://mybucket/myobject