How-to restore a directory or file from a snapshot
How can I restore a deleted file from my home or lab directory?
$LAB and $HOME directories are backed up with "snapshots" hourly for the last 23 hours and daily for the last 23 days. If you need to restore a file or directory to a previous version within the time constraints of snapshot, follow the instructions below.
Windows Mapped Drive
Windows makes it easy to restore a file or directory from your $LAB or $HOME directory, as long as it is mapped to your computer. Remember, you need to be connected to the VPN to access a mapped directory from off campus.
- Navigate to the folder or directory file the Windows File Explorer
- Right-click on the file, and click restore previous versions
Navigate to the version you would like to restore, and hit Restore
This will overwrite the existing file in the directory!
Snapshots can be accessed and restored from an SSH terminal from any operating system. Please follow How-to: Connect via SSH (PuTTY, macOS terminal, X2Go) for more information on connecting via SSH.
- Open an SSH connection to head-01.arcc.albany.edu
Using the "cd" command, change directories to the file or directory that needs to be restored
In this example, we will demonstrate with an example file
Use the "ls" command to check if the file is in the directory, here we will restore spawn_jupyter.sh
- Now, "cd" into the ".snapshot" directory, and "ls" to see what snapshots are available. Note that the snapshots are additional directories.
- "cd" into the appropriate snapshot directory. Here we are restoring the backup from 0825 on 15 Apr 2019
- You can check the file with the "more" command, or other command of your choice
- Next, "cp" the file two directories up (../../) and rename it if you'd like to. Here, we append _restored so the files can be further compared
- Navigate out of the snapshot (cd ../../), to the original directory and verify the restored file is there