Coda File System

11.6. Backup Scripts

Although the backup program handles all the tricky details involved in Coda backup, there still remains some issues to be handled, most notably the saving of the dump files to tape. This is done by a series of scripts, backup.sh , and tape.pl .

backup.sh takes the name of the directory in which to run backups. It creates a subdirectory who's name indicates the date that backup was run. It then runs the backup program, using the dumplist file in the directory specified in the arguments, saving the output of backup in a logfile in the newly created subdirectory. It copies in the current Coda databases (so they will be saved to tape along with the dump files). It then invokes tape.pl to write and verify that the files have been safely recorded.

tape.pl performs the work of saving the files on tape. It takes the directory in which the backup was taken (the subdirectory generated by backup.sh) , and the device name of the tape drive. It first checks to see that the tape to be used is either empty or has the correct label. For Coda at CMU this means checking that the tape was last used on the same day of the week. It then gathers the dump files and databases into groups and generates the tape label for this backup. Finally it writes the tape label and all the groups to the tape via the dump (1) facility, marking the end of the tape with another copy of the tape label.

tape.pl then verifies that it did its job correctly. It first reads off the tape label, comparing it with one stored in the backup directory. It then scans all the dump files, listing the contents of the dumps and the commandline parameters for restore to stdout which has been redirected by backup.sh to the backup logfile.

restore (1) is used to extract a dump file from a Coda backup tape. The backuplogs contain the commandline that is needed to jump to the correct part of the tape.