November 25, 2024
Update 06/01/2022: Please be advised that snapshot backups have been discontinued until additional storage becomes available.
Introduction
Looking for a copy of a file from before it was modified? Need a file that has been deleted or can't be found? It happens, fortunately the BriefCASE storage system takes periodic snapshots of its file systems which can be used to retrieve earlier copies of files in scenarios like these. Note that not all folders on Scientific Computing (SciC) Linux Clusters are on the BriefCASE storage, for those that are not there may be a tape backup available.
Old snapshots are automatically deleted! Don't delay, if a file needs restoring do this as as soon as possible.
Snapshots are kept (subject to available space) for home folders and folders under /data. Snapshots are not kept for /scratch
How to identify the snapshot folder location
Snapshots are kept in a special hidden folder ".snapshot" which does not appear in any file listing. Despite not being visible to the "ls" command, if there are snapshots available for any location the command "cd .snapshot
" will allow you to enter the snapshot area.
- change directory "cd" to the location where files need to be restored to
- change directory to the snapshot area with "cd .snapshot"
How to restore files from snapshot backup
cd .snapshot
Once here, list the available snapshots which are ordered by date.
$ ls -1
2013.11.10.12.00.01.groups_week
2013.11.16.05.00.01.groups
2013.11.17.05.00.01.groups
2013.11.17.12.00.01.groups_week
2013.11.18.05.00.01.groups
2013.11.19.05.00.01.groups
Each dated snapshot folder contains a read-only copy of the volume at that time. Browse the snapshots and restore files by copying back to the main folder.
How many snapshots are kept?
The number of snapshots kept varies over time depending on how much data on BriefCASE has changed recently and the amount of free space. Currently (correct at 12/23/13) snapshots are available from the two previous Sundays and from the previous 4 days.
WARNING: snapshots do not replace the need to keep a backup of your data. It is possible for all snapshots to be automatically deleted if free disk space is low
Reduce the risk of accidental global file deletion
When working at the Linux command line there is no equivalent to the Wastebasket/Recycle Bin on the desktop. Reduce the risk of accidentally deleting all files by including this code in your .bashrc file. If for example 'rm test *' were typed when 'rm test*' was intended this function would print a prompt asking if all files in the folder should really be deleted.
alias rm="IFS='^'; set -f; rmstar"
function rmstar
{
set +f # re-enable globbing
local oldargs=$@ # cache command line
local rm=`which rm 2> /dev/null`
local skipdel=0
if [ $# -gt 0 ];
then
local rmstarfound=0
# search for a '*'
until [ -z "$1" ];
do
case "$1" in
"*") rmstarfound=1; break;;
*) ;;
esac
shift
done
# if a '*' was found prompt for confirmation
if [ $rmstarfound -eq 1 ]
then
ask "$RED Do you really want to delete all files? $NC "
if [ "$?" -eq 1 ]
then
skipdel=1
fi
fi
fi
if [ $skipdel -eq 0 ];
then
$rm $oldargs
fi
unset IFS
}