Configuring Fault Tolerance
Also available as:
PDF
loading table of contents...

Recover data from a snapshot

If data is erroneously removed from a directory for which snapshots are available, you can recover the lost data using snapshots. The snapshot ensures that the file blocks corresponding to the deleted files or directories are not removed from the file system. Only the metadata is modified to reflect the deletion.

You must have read access to the files or directories that you want to restore.
Run the hdfs dfs command with the cp option to copy the deleted data from the snapshot to the destination directory.
The following example shows how you can recover a file imp_details.xls from a snapshot of the directory (/data/dir1) that contained the file:
hdfs dfs -cp /data/dir1/.snapshot/s20180412-065533.159/imp_details.xls /data/dir1/