Snapshots¶
Only data stored in /home/$USERNAME
are managed with snapshots. If a file is lost in this filesystem, it can be recovered from daily intervals over the past week. It can be recovered on a weekly basis for the past 30 days. If the file is on a different filesystem (e.g., /blue
or /orange
), that file cannot be recovered unless backups are being performed for that directory.
Basics¶
- Change directory to
/home/$USERNAME/.snapshot
, where$USERNAME
is your username. - You will see at least seven directories, each with a day of the week in the name. If the current day is Friday, the directory labeled
##_friday_home
will be the snapshot from 5:00 am today. - You may also see a couple
##_weekly_home
directories. These are taken every Monday morning at 3:00 am and kept for 30 days. - Change directory to the snapshot you wish to restore from and navigate to your missing file.
- Copy the file(s) as needed back to your main home directory.
Video demo¶
Here is a video demo of the process of restoring from a snapshot.
Example¶
- Username: it-rc-test
- Day: Wednesday
Suppose you have accidentally deleted a file in your home area called /home/it-rc-test/test/important.txt
. You know that file was there yesterday, so you should be able to recover it.
[it-rc-test@login1 ~]$ ls /home/it-rc-test/test
important.txt also_important.txt not_so_important.txt
[it-rc-test@login1 ~]$ rm -rf important.txt
[it-rc-test@login1 ~]$ ls /home/it-rc-test/test
also_important.txt not_so_important.txt
[it-rc-test@login1 ~]$ cd /home/it-rc-test/test
[it-rc-test@login1 ~/test]$ ls .snapshot
56_sunday_home 57_monday_home 58_tuesday_home 59_wednesday_home 60_thursday_home 61_friday_home
[it-rc-test@login1 ~/test]$ cd .snapshot/58_tuesday_home
[it-rc-test@login1 ~/test/.snapshot/58_tuesday_home]$ ls
important.txt also_important.txt not_so_important.txt
[it-rc-test@login1 ~/test/.snapshot/58_tuesday_home]$ cp important.txt /home/it-rc-test/test/important.txt
[it-rc-test@login1 ~/test/.snapshot/58_tuesday_home]$ cd /home/it-rc-test/test
[it-rc-test@login1 ~/test]$ ls
important.txt also_important.txt not_so_important.txt