Snapshot
From CsWiki
Snapshot
The files in your home directory are backed up a number of times a day and can be restored using the snapshot command.
This is useful if you delete a file by accident or want to go back to an older version of it because you have saved changes you no longer want.
If you want to restore a file, go to the directory where it used to be and type
snapshot
You will then get the message
Using .snapshot /cs/stud/uripeleg/Desktop [Feb 09 15:35:00] >
Using the 'help' command within the snapshot utility you will get help on its commands.
Commands are:
cd [dir] - *change directory
changetime {Mar 19 [00:00]} - change backup time to Mar 19 00:00
cp {file...} - *recover file[s]
cpv {13} - recover version number 13
exit - exit
find {file} - find file
findv {file} - find all versions of file
force - never ask before overwriting
help - show this message
ls [-aAcCdfFgilLqrRsStu1] [file...] - *list
lsv {file} - list all versions of file
noforce - ask before overwriting (default)
norename - don't rename (default)
rename - always rename
sh {cmd...} {file} - *run cmd on file
shv {cmd...} {13} - run cmd on version number 13
When using the snapshot utility you are actually browsing in an old version of your directory. The time of the backup through which you are browsing is shown at the end of the command line. For example if the command line is:
/cs/stud/uripeleg/Desktop [Feb 09 14:20:01] >
Then you are browsing through the directory as it was in Feb 09 14:20:01.
You might want to view a backup from an earlier time - to do this you can use the changetime command.
/cs/stud/uripeleg/Desktop [Feb 09 14:20:01] > changetime Jan 30 12:00 Backup time changed successfully to Jan 30 00:00:48 /cs/stud/uripeleg/Desktop [Jan 30 00:00:48] >
This will allow you to see the file system as it was at an earlier time.
If you know which file you are looking for type lsv <filename> and it will list all the backed up versions of the file in existence.
/cs/stud/uripeleg [Feb 09 15:35:00] > lsv snapshot2 -rwxrwxrwx 1 uripeleg stud 16698 Jan 29 16:29 snapshot2 [1] -rwxrwxrwx 1 uripeleg stud 15301 Jan 28 14:13 snapshot2 [2]
You can then use the cpv <number> command to copy the backup to your file system.
/cs/stud/uripeleg [Feb 09 15:35:00] > cpv 2 'snapshot2' -> '/cs/stud/uripeleg/snapshot2' cp: overwrite `/cs/stud/uripeleg/snapshot2'? y
In this case there were two versions of the file snapshot2 - one from Jan 29 and one from Jan 28. Typing cpv 2 restored the second
file to our current file system.
The sh and shv commands allow you to use regular unix commands. Typing sh ls for example would simply run the ls command in the directory you are in. Typing shv cat 2 after the lsv snapshot2 command would have allowed us to see the contents of the older snapshot2 file. The cpv and shv commands can only be used immediately following an lsv <filename> command.
Problem with restoring deleted directories:
You might encounter a problem if you deleted an entire directory. If this is the case do the following:
Use the changetime command to go to a time when the directory existed.
Use the ls command to make sure it really is there.
Use the lsv command to see versions of the directory.
You will not be able to use the cd command to view the directory - you must first copy it into your filesystem.
Use the cpv <number> command to copy the directory to your system. This will also copy all subdirectories and files.
Alternately - if you are only interested in a specific file - you can browse for it using the ls command (but not the cd command). Finally restore the file using cp or cpv.
