Files that have been accidentally deleted or a previous version of them can be recovered from a snapshot. The way a file is recovered depends on the underlying file-system (Windows/Linux) and in the case of Linux, the storage level. However if you want to manage revisions of a file, for example to record code changes, then you should use a repository service such as our gitlab service and not rely on the file system snapshots.
For files on windows research shares, which are usually mapped from \\dfs.rdg.ac.uk\research, you can use previous versions which are also sometimes called shadow copies. This does not apply to shares found under \\dfs.rdg.ac.uk\research-nfs. Files in these shares need to be recovered in same way as a Linux Export (see below).
The way you recover a file under /storage on Linux computers, depends on the level of the storage (gold or silver). The approach is similar in both cases: go to the appropriate snapshot directory and use the copy command “cp” to copy the file you want to recover into the normal storage. The difference between gold and silver storage is the location and the name of the snapshots.
For gold level storage the snapshots are located in the .zfs/snapshot directory at the top of the export (/storage/gold/<export>. For example in the case of the export act-data2
ab123456@nxnode:/storage/gold/act-data2$ ls .zfs/snapshot .zfs/snapshot/hpr-2019-03-05-04-30-00-104 .zfs/snapshot/hpr-2019-03-06-04-30-00-125 .zfs/snapshot/hpr-2019-04-13-03-30-01-119 .zfs/snapshot/hpr-2019-04-14-03-30-00-234 .zfs/snapshot/hpr-2019-04-15-03-30-00-258 .zfs/snapshot/hpr-2019-04-16-03-30-00-273 ...
Inside each snapshot is a complete copy of all the files and directories in the export as they were when the snapshot was taken. So if you want to recover a file in a sub-directory you need to use the change directory command “cd” to navigate to the sub-directory in the snapshot or give the full path-name to the “cp” command.
cd /storage/gold/act-data2/.zfs/snapshot/hpr-2019-03-05-04-30-00-104/my/sub/directory cp -i file-to-recover /storage/gold/act-data2/my/sub/directory
or
cd /storage/gold/act-data2/my/sub/directory cp -i /storage/gold/act-data2/.zfs/snapshot/hpr-2019-03-05-04-30-00-104/my/sub/directory/file-to-recover .
Because the snapshots appear in the directory structure care needs to be taken when using recursive commands such as e.g. “find” or “du” at the top level of the export.
The current schedule for snapshots on gold storage is
Time | Local | Remote |
---|---|---|
Every hour, on the hour | Keep 25 snapshots | Keep 50 snapshots |
04:30 every day | Keep 90 snapshots | Keep 90 snapshots |
On silver storage the snapshots are available under .snapshot in every directory, except in some cases the top of the export. The .snapshot directory does not appear unless explicitly referenced so it will NOT appear in the output of the list command “ls -a” or when using recursive commands such as “find” or “du” unless it has been recently accessed.
ab123456@nxnode:/storage/silver/export/my/sub/directory1$ ls .snapshot afs-auto-snap_daily-2019-07-02-2300 afs-auto-snap_hourly-2019-07-09-0200 afs-auto-snap_daily-2019-07-08-2300 afs-auto-snap_hourly-2019-07-09-0300 afs-auto-snap_hourly-2019-07-08-1000 afs-auto-snap_hourly-2019-07-09-0400 afs-auto-snap_hourly-2019-07-08-1100 afs-auto-snap_hourly-2019-07-09-0500 afs-auto-snap_hourly-2019-07-08-1200 afs-auto-snap_hourly-2019-07-09-0600 afs-auto-snap_hourly-2019-07-08-1300 afs-auto-snap_hourly-2019-07-09-0700 afs-auto-snap_hourly-2019-07-08-1400 afs-auto-snap_hourly-2019-07-09-0800 afs-auto-snap_hourly-2019-07-08-1500 afs-auto-snap_hourly-2019-07-09-0900 afs-auto-snap_hourly-2019-07-08-1600 afs-auto-snap_hourly-2019-07-09-1000 afs-auto-snap_hourly-2019-07-08-1700 afs-auto-snap_monthly-2019-02-01-0000 afs-auto-snap_hourly-2019-07-08-1800 afs-auto-snap_monthly-2019-03-01-0000 afs-auto-snap_hourly-2019-07-08-1900 afs-auto-snap_monthly-2019-03-31-2300 afs-auto-snap_hourly-2019-07-08-2000 afs-auto-snap_monthly-2019-04-30-2300 afs-auto-snap_hourly-2019-07-08-2100 afs-auto-snap_weekly-2019-04-20-2300 afs-auto-snap_hourly-2019-07-09-0000 afs-auto-snap_weekly-2019-04-27-2300 afs-auto-snap_hourly-2019-07-09-0100 afs-auto-snap_weekly-2019-05-11-2300
Inside each snapshot is a complete copy of all the files and sub-directories in the relevant directory as they were when the snapshot was taken. So to recover a file from a snapshot you can use the copy command “cp”:
cp -i .snapshot/afs-auto-snap_hourly-2019-07-09-0900/file-to-recover .
The current snapshot schedule for silver storage is
Name | Frequency | Keep |
---|---|---|
Hourly | Every 1 hour | 24 |
Daily | Every 1 day | 7 |
Weekly | Every week on Sun | 4 |
Monthly | Every month on 1 | 3 |
Files in the UNIX home directories /home/users/<username> can be restored in the same way as silver storage.