Restoring Lost Files

Restoring Lost Files

Did you know that your home directory is “snap-shotted” daily at 12:00 AM? A snapshot is a copy of your home directory at an instance in time. This allows researchers to recover deleted or corrupted data during the retention period. The snapshot retention period is 3 days.

To see this change into your .snapshot directory and list the contents. Below is an example:

$ cd .snapshot
.snapshot/$ ls -l
drwx------.   Oct 30 11:16 FSAnalyze-Snapshot-Current-1573556429
drwx------.   Oct 30 11:16 hpc_home_daily_2019-11-11-_00-00
drwx------.   Oct 30 11:16 hpc_home_daily_2019-11-12-_00-00
drwx------.   Oct 30 11:16 hpc_home_daily_2019-11-13-_00-00
drwx------.   Oct 30 11:16 hpc_homes
drwx------.   Oct 30 11:16 SIQ-36d1cb9e7276e96b6131e2ebb69033e9-latest

Note: Those snapshots are immutable. You cannot modify or remove them. You cannot write into a .snapshot dirrectory.

Ignore the special FSAnalyze and SIQ directories. You will be interested in the three hpc_home_daily directories and the hpc_homes directory. The hpc_homes directory will always be the latest snapshot (here it will be hpc_home_daily_2019-11-13-_00-00).

To restore a file just copy your files or directories from one of the above “home” directories to somewhere in your home directory.

Remember, the retention period is just 3 days so so you can’t recover anything that is older than 3 days.

Alias the “rm” Command

To reduce the likelyhood of accidently deleting an important file you can alias the remove command (rm) so that it prompts you before every removal. Insert into your .bashrc file this line:

alias rm='rm -i'

Then logout and login again for this change to take effect.

Read the man page for the remove command i.e. man rm.

This is custom footer