flost
If you know when you lost the file, the easiest way is to use the flost command.
To run the tool you will need to specify the location where the lost file was with the -w argument:
$ flost -w /home
This script will help you try to recover lost home or group directory contents.
NB: Scratch directories are not backed up and cannot be recovered.
Currently anchoring the search under: /home
If your lost files were on a different filesystem, exit now with Ctrl-C and
rerun flost with a suitable '-w WHERE' argument (or see 'flost -h' for help).
Please enter the date that you lost your files: MM/DD/YYYY
The closest recovery snapshot to your date of loss currently available is from
MM/DD/YYYY 12:00am. First, you will need to SSH to a dedicated
service host zfs.anvil.rcac.purdue.edu, then change your directory
to the snapshot location:
$ ssh zfs.anvil.rcac.purdue.edu
$ cd /home/.zfs/snapshot/zfs-auto-snap_daily-YYYY-MM-DD-0000
$ ls
Then copy files or directories from there back to where they belong:
$ cp mylostfile /home
$ cp -r mylostdirectory /home
Here is an example of /home
directory. If you know more specifically where the lost file was you may provide the full path to that directory.
This tool will prompt you for the date on which you lost the file or would like to recover the file from. If the tool finds an appropriate snapshot it will provide instructions on how to search for and recover the file.
If you are not sure what date you lost the file you may try entering different dates into the flost to try to find the file or you may also manually browse the snapshots in /home/.zfs/snapshot
folder for Home directory and /anvil/projects/.snapshots
folder for Projects directory.