Recovering User Files From Snapshots
Daily snapshots are taken of each users' $HOME
directory and the /data
directory. These snapshots are taken every day at 12:00 PM (noon) and persist for 4 weeks.
Seeing all the snapshots
Every directory in your $HOME
and /data
has a hidden subdirectory called .snapshot
.
Below is an example of going to one of those directories in $HOME
and the partial output of listing all the files in there.
[wdizon@login01:~]$ cd ~/.snapshot
[wdizon@login01:~/.snapshot]$ ls
ScheduleName_duration_2023-06-16_12:00/ ScheduleName_duration_2023-06-30_12:00/
ScheduleName_duration_2023-06-17_12:00/ ScheduleName_duration_2023-07-01_12:00/
ScheduleName_duration_2023-06-18_12:00/ ScheduleName_duration_2023-07-02_12:00/
[additional lines omitted]
[wdizon@login01:~/vasp/CeO2job/.snapshot]$ ls
ScheduleName_duration_2024-02-21_12:00/ ScheduleName_duration_2024-03-06_12:00/
ScheduleName_duration_2024-02-22_12:00/ ScheduleName_duration_2024-03-07_12:00/
ScheduleName_duration_2024-02-23_12:00/ ScheduleName_duration_2024-03-08_12:00/
ScheduleName_duration_2024-02-24_12:00/ ScheduleName_duration_2024-03-09_12:00/
[additional lines omitted]
Seeing all the files inside a snapshot
For the above example, to recover a file that existed in my $HOME
directory on July 2nd at 2:00 PM, the commands are:
[wdizon@login01:~]$ cd ~/.snapshot/ScheduleName_duration_2023-07-07_12:00
[wdizon@login01:~/.snapshot/ScheduleName_duration_2023-07-07_12:00]$ ll
total 13329248
drwx------ 56 wdizon grp_rcadmins 4134 Jul 1 21:54 ./
dr-xr-xr-x 2 root root 0 Jul 13 12:00 ../
-rw-r----- 1 wdizon grp_rcadmins 18976 Jan 24 14:45 1654163.crash
drwx------ 3 wdizon grp_rcadmins 27 Jan 27 09:12 .agisoft/
-rwxr-x--- 1 wdizon grp_rcadmins 17712 Jun 28 15:09 a.out*
drwxr-x--- 7 wdizon grp_rcadmins 427 Jun 21 16:19 apache-log4j-1.2.17/
drwx------ 3 wdizon grp_rcadmins 23 Jun 22 2022 .apptainer/
-rw-r----- 1 wdizon grp_rcadmins 1332026 Apr 26 09:33 apr2
-rw------- 1 wdizon grp_rcadmins 20 Jun 22 2022 .ash_history
-rw------- 1 wdizon grp_rcadmins 163020 Jul 2 00:06 .bash_history
[rest omitted]
Note, the files' datestamp will reflect their original metadata, not the date of the snapshot. Anything in this directory, however, can be reliably seen as the exact state of the file at the moment of the snapshot.
Recovering any of the files
Do not edit files within the .snapshot
directory, but instead copy the file/directories to a new location. Identify the files you wish to recover (using either command line tools like above, or SFTP/SCP tools like Filezilla or Cyberduck), to copy these files back to their new home.
[wdizon@login01:~/.snapshot/ScheduleName_duration_2023-07-02_12:00]$ cp -v usage_compare ~/usage_compare.recovered
'usage_compare' -> '/home/wdizon/usage_compare.recovered'
The user now has the recovered file in their normal working space, since the file has been copied out of snapshot space.