Snapshot Recovery Procedure
The following example shows how to recover a file located in a specific folder.
- Go to the directory where you want the recovered file located after you recover it. Within this, and all directories, is a hidden directory called ".snapshot".
Note: This directory does not appear with "ls" using any options, but is accessible with "cd".
<71 scully:~ >cd .snapshot
<72 scully:~/.snapshot >pwd
/home/username/.snapshotNote: If you are unsure of the location of the file(s) you are attempting to recover, keep in mind that you can first change into the .snapshot directory then move into the .snapshot directory/folder where the file you want to recover is stored.
-
Type ls . You will see the hourly, nightly and weekly snapshot archives.
To see the timestamps associated with the creation of each of the snapshots, type ls -lu. The timestamps will help you select the appropriate snapshot to use to recover your file(s).
Note: These timestamps are an approximation. If there have not been any modification to file(s) in your directory a new snapshot is not created.
- Next, change to the snapshot directory that you believe contains the version of the file(s) you want to recover.
If you type pwd, you will see that you are two directory levels below the directory in the active file system.
<73 scully:~/.snapshot/hourly.2018-01-23_1101 >pwd
/home/username/.snapshot/hourly.2018-01-23_1101
<74 scully:~/.snapshot/hourly.2018-01-23_1101 >ls -a
... file1 file2 file3 - To overwrite your current file with the file that you are recovering, simply copy it to its original location. For a copy of the file, use the cp command as follows:
-
<75 scully:~/.snapshot/hourly.2018-01-23_1101 >cp file2 ~/.
To save the recovered file to a different file name, to distinguish it from the current active file, use as follows:
<75 scully:~/.snapshot/hourly.2018-01-23_1101 >cp file2 ~/file2.R
- Return to the active file system. You should see that your file is now available:
<76 scully:~/.snapshot/hourly.2018-01-23_1101 >cd ~
<77 scully:~ >pwd
/home/username
<78 scully:~/path >ls -a
... file1 file2 file3