Restoring Files from Backups


Restoring Files from Unix, Linux and Macintosh Machines

Restoring Files from Research/Administrative File Server

Restoring Files from Undergrad File Server

Restoring Files from Unix, Linux and Macintosh Machines

If you are not on the student or general CS environment and use an X-Terminal to access your account, you can use the Graphical User Interface nwrecover (Legato NetWorker has no GUI nwrecover for Mac OS X clients) command to get a copy of your file from the backup system.

  1. Type nwrecover on your X-window terminal, where you are logged onto the system to which you want to restore the file. This will bring up an interactive window. See below if you don't have an X-window terminal, or if the nwrecover command won't run on your system.
  2. From the View menu, choose Versions to see what backup dates are available.
  3. Decide which one you want, then from the Change menu, select Browse Time.
  4. On the calendar, click the date of the backup from which you want to restore.
  5. In the main window, click the box beside the file(s) you want to restore (Subdirectories are indicated in yellow).
  6. Note that the relocate (from Options menu) command is useful if you want to avoid overwriting the original file. This is especially important if you are restoring a mailbox, where you likely don't want to overwrite your current mailbox, as you would then lose all your newest messages.
  7. When you have selected all of the files you wish to restore, choose the File menu, then select Start Recover.

If the X Window System is unavailable to you, or for some reason nwrecover doesn't work, you can use the recover command to restore your files. It is a text-based command which works in a similar manner. Use the versions command to see which backups are available, the changetime command to select which backup you want, then use the add command to tag the file. The relocate command will allow you to restore the selected file to a different location than the original. This is useful to avoid overwriting the original. The recover is used to start the restore. For help with the above commands, type help at the recover> prompt.

If the required tapes are available to the robot, the restore will be done automatically. If the tapes are not available, the Operator will have to load them. The restore may take a while in either case, so please be patient and let the restore finish. Be sure to exit the recover program when you are done, as only a few people can access the robot backup system at the same time.

An example using recover is shown below:

ubuntu1404-202:~> recover
Current working directory is /home/gxshen/
recover> help
6477:recover: Available commands are:
	add [-q] [filename] - add `filename' to list of files to be recovered
	cd [dir] - change directory to dir
	changetime [date | -l locale_date] - change the time that you are browsing, changetime [-l] displays the supported [[locale_]date] format
	debug
	delete [filename] - delete `filename' from the recover list
	destination - print destination location for recovered files
	dir [/w] [filename...] - list filename
	exit - immediately exit program
	force - overwrite existing files
	help or `?' - print this list
	lf [-aAcCdfFgilLqrRsStu1] [filename...] - list filename type
	list [-c | -l]  - list the files marked for recover
	ll [-aAcCdfFgilLqrRsStu1] [filename...] - long list filename
	ls [-aAcCdfFgilLqrRsStu1] [filename...] - list filename
	noforce - do not overwrite existing files
	pwd - print current directory
	quit - immediately exit program
	recover - recover requested files
	relocate [dir] - specify new location for recovered files
	verbose - toggle verbose mode; feedback about what is going on
	versions [filename] - report on each version of file `filename'
	volumes [filename] - report volumes needed to recover marked files
6478:recover: `filename' can be either a file or a directory
recover> chan Jan 20
6497:recover: time changed to Sat Jan 20 23:59:59 2018
recover> ls -l .cshrc
-rw-r--r-- gxshen           6557 Dec 05 10:17 .cshrc
recover> add .cshrc
1 file(s) marked for recovery
recover> vol
Volumes needed (all on-line):
        57004 at /dev/tape/by-id/scsi-35005076312486d24-nst
recover> des
recover files into their original location
recover> rel /u/gxshen/tmp
recover> recover
Recovering 1 file from /home/gxshen/ into /u/gxshen/tmp
Volumes needed (all on-line):
        57004 at /dev/tape/by-id/scsi-35005076312486d24-nst
Total estimated disk space needed for recover is 8 KB.
Requesting 1 file(s), this may take a while...
Recover start time: Tue Jan 30 14:44:09 2018
Requesting 1 recover session(s) from server.
./.cshrc
Received 1 file(s) from NSR server `backup.cs.uwaterloo.ca'
Recover completion time: Tue Jan 30 14:46:18 2018
recover> quit
ubuntu1404-202:~> 

Restoring Files from Research/Administrative File Server

FILES

  1. If you don't want to overwrite the original file, change its name or move it somewhere else (eg to a different directory).
  2. From your home directory, type cd .snapshot
    Note that .snapshot does NOT show up on ls -la or any other ls command.
  3. Type ls -lt */filename to see a list of available snapshots of your file(s). These will be listed as hourly, daily, or weekly.
  4. Copy the file(s) back to your home directory (eg cp daily.2018-01-28_0010/filename ~ )
    If you get a message saying that the files are identical (not copied) you will either have to delete the version you are trying to overwrite, or rename it before copying the older version from .snapshot.

MAILBOXES

  1. Type cd `maildir`/.snapshot (use the backquote that is on the ~ key).
  2. Type ls -lt */YourUserID to see a list of available snapshots of your mailbox. YourUserID will be the first 8 characters of your userid.
  3. You probably want to restore the old mailbox to a different location, as the restored one will overwrite it, and you will lose any new messages. For example, to restore the mailbox to your home directory:
    cp daily.2018-01-28_0010/jq2publi ~
    If you really do want to restore your mailbox to the default location:
    cp daily.2018-01-28_0010/jq2publi `maildir` (for example)

If the file is not in the online snapshots, mail csi-backups@cs the complete pathname plus the time of the last major change and the time when the file was deleted or corrupted. This process can require a great deal of manual intervention.

Restoring Files from Undergrad File Server

Same as the Restoring Files from Research/Administrative File Server described as above.