Home directories at HPC2021 are supported by ZFS. A daily snapshot (usually in the time-frame of 3~4 am local time) will be done and a maximum of 7 of them are kept. ZFS snapshots are read-only and you are able to retrieve the files from such snapshots. Here is how:
To get a list of snapshots, you may do:
ls -al /home/myusername/.zfs/snapshot/
Notice that the .zfs
folder is special as it is not shown even if you use the command ls -al /home/myusername
which normally show all the hidden folders. The timestamp of when the snapshots were taken is apparent in the snapshot name.
The contents of your home directory at that specified moment is kept in the snapshot (which is always read-only, regardless of what the Unix permission bits say). For example, with the following command the snapshot of the file on 22 March 2021 could be found:
ls -al /home/myusername/.zfs/snapshot/zfs-auto-snap_daily-2021-03-22-0319/deleted_file
You may also use your editor/readers to view a read-only file with a full path. However, in order to get the file back, you should copy it back to your active folder. Note the use of the -a
flag which also copies the file attributes:
cp -a /home/myusername/.zfs/snapshot/zfs-auto-snap_daily-2021-03-22-0319/deleted_file /home/myusername/deleted_file