petec@umcp-cs.UUCP (02/28/84)
: Run this shell script with "sh" not "csh" PATH=:/bin:/usr/bin:/usr/ucb export PATH all=FALSE if [ $1x = -ax ]; then all=TRUE fi /bin/echo 'Extracting README' sed 's/^X//' <<'//go.sysin dd *' >README Enclosed are the sources to filtapmgr, whichtape, manual entries, sample shell scripts, and include files. These programs can be used to maintain and access a database of filenames that are currently on back-up tapes. These programs are currently used on a VAX 11/780 running 4.1c BSD at the University of Maryland. Several changes have been made to the dump program that these programs are dependent on, so the diff listings for each of the dump modules is also included. Since the changes to the dump program were done before I started working, I'm not sure of the exact changes, but here is what I think they are: 1. The TAPNAMOPT has been added - this causes the dump program to ask for the name of the tape being dumped on. If the 't' option is given, then the next argument is taken as the tape name. 2. The format of the /etc/dumpdates file has been changed so that it looks like this: X/dev/rrp1e 1 Fri Feb 17 10:28:00 1984 I 0 X/dev/rrp0a 1 Fri Feb 17 10:27:29 1984 I 0 X/dev/rrp0g 1 Fri Feb 17 10:10:45 1984 I 0 X/dev/rrp2c 2 Thu Feb 16 09:51:59 1984 H 0 X/dev/rrp1e 0 Wed Feb 15 23:43:53 1984 30,31,32,33 0,5059,8901,13531 The level of the dump is listed with the file system and the date. All tapes for that dump are listed, along with the first inode number for that tape (tape 33 starts at inode 13531). This is very helpful during restoration from multi-volume dumps. Here's a quick run-down of what we have: - diff listings for the dump program - filtap.h and dumprestor.h include files - filtapmgr source in filtapmgr.c - whichtape source in whichtape.c, getrecord.c, timdmptap.c . - manual entries - README files, and sample shell script. There are several parameters that can be set by you. MAXTAPNAM is defined in dumprestor.h and filtap.h, and is the maximum number of characters that can make up the tapename. filsys_fil is the name of the database file. MAXBACKUPS is the number of records kept for each file entry; it is currently set at 3. In filtapmgr.c, the names of the file systems that you dump and want to maintain records about are in the function ckfilsys(); it would be better if they weren't hard-coded, but at this point they are. Most of this is the work of Patrick Steranka, who did the dump hacks and the original designs of filtapmgr and whichtape. Patrick has since graduated and I have continued with refinements, additions, and corrections. Therefore, please send comments, bug reports, etc to me. I don't think that either one of us thought that this code would ever be sent out, so please bear with us if problems arise. All I can say is that what is being sent out works here at Maryland and is very helpful. I hope it is for you too. Pete Cottrell Please respond to: Pete Cottrell, Univ. of Md. Comp. Sci. Dept. UUCP: {seismo,allegra,brl-bmd}!umcp-cs!petec CSNet: petec@umcp-cs ARPA: petec.umcp-cs@maryland //go.sysin dd * made=TRUE if [ $made = TRUE ]; then /bin/chmod 644 README /bin/echo -n ' '; /bin/ls -ld README fi /bin/echo 'Extracting dumprestor.h' sed 's/^X//' <<'//go.sysin dd *' >dumprestor.h #define NTREC 10 #define MLEN 16 #define MSIZ 4096 #define MAXTAPDMP 10 #define MAXTAPNAM 2 #define TS_TAPE 1 #define TS_INODE 2 #define TS_BITS 3 #define TS_ADDR 4 #define TS_END 5 #define TS_CLRI 6 #define MAGIC (int)60011 #define CHECKSUM (int)84446 struct spcl { int c_type; time_t c_date; time_t c_ddate; int c_volume; daddr_t c_tapea; ino_t c_inumber; int c_magic; int c_checksum; struct dinode c_dinode; int c_count; char c_addr[BSIZE]; } spcl; struct idates { char id_name[16]; char id_incno; time_t id_ddate; #ifdef TAPNAMOPT char id_pdate[25]; int id_notapes; char id_tapes[MAXTAPDMP][MAXTAPNAM+1]; ino_t id_inos[MAXTAPDMP]; #endif }; struct idates_f { char id_name[16]; char id_incno; char id_pddate[26]; }; #define DUMPOUTFMT "%-16s %c %s" /* for printf */ /* name, incno, ctime(date) */ #define DUMPINFMT "%16s %c %[^\n]\n" /* inverse for scanf */ #ifdef TAPNAMOPT #define TNDUMPOUTFMT "%-16s %c %s\t%s %s\n" /* for printf */ #define TN_DUMPOUTFMT "%-16s %c %s\n" /* name, incno, ctime(date) */ #define TNDUMPINFMT "%16s %c %[^\t\n]s" /* inverse for scanf */ X/* This is the length of the old dump format */ #define ENDOLDLINE 44 #endif #define TAPNAMFMT "%d %s %u\n" /* tapeno, tapename, starting inode */ //go.sysin dd * made=TRUE if [ $made = TRUE ]; then /bin/chmod 644 dumprestor.h /bin/echo -n ' '; /bin/ls -ld dumprestor.h fi /bin/echo 'Extracting filtap.h' sed 's/^X//' <<'//go.sysin dd *' >filtap.h #define MAXBACKUPS 3 #define MAXTAPNAM 2 #define ERROR -1 #define NUMALLOCS 1024 typedef struct tnode{ char tapes[MAXBACKUPS][MAXTAPNAM+1]; /* Leave room for null at end */ ino_t inodes[MAXBACKUPS]; int dir; struct tnode *next; struct tnode *down; char Marked; char name[15]; } NODE, *PTRNODE; char *filsys_file = "/g/etc/filesontapes"; PTRNODE getnode(); //go.sysin dd * made=TRUE if [ $made = TRUE ]; then /bin/chmod 644 filtap.h /bin/echo -n ' '; /bin/ls -ld filtap.h fi /bin/echo 'Extracting filtapmgr.8' sed 's/^X//' <<'//go.sysin dd *' >filtapmgr.8 X.TH FILTAPMGR 8 "Univ. of Maryland" X.UC 4 X.SH NAME filtapmgr \- file tape manager program. X.SH SYNOPSIS X.B filtapmgr [ X.B \-f file_sys file ] [ X.B \-vsd ] [ X.B \-t tapename ] filsys dumpdir_file tapename [ filsys dumpdir_file tapename ] ... X.sp X.B filtapmgr [ X.B \-f file_sys file ] [ X.B \-vsd ] X.B \-p tapename X.SH INTRODUCTION X.I Filtapmgr is intended to simplify the burden of managing tape dumps. It maintains a backup record for every file dumped onto a particular tape. To do this, however, it must rely on the dumpdir program to produce a listing of all of the files on a given tape. X.PP It is recommended that after a dump is done a dumpdir should be run to produce a listing of files that were dumped on that tape. Then this program can be run to maintain a list of tapes upon which a given file can be found. X.PP The backup information is used to assist in restoration of files and/or directories. (See whichtape, for an example of how this information can be used.) X.SH OPTIONS The following options are available. X.TP 12n X.B \-v X.I verbose option: Prints messages informing user about progress of program. X.TP X.B \-s X.I summary option: Prints summary information about all entries in the compacted file_system file. (Current file_system file is /g/etc/filesontapes.) (See below for description of summary information.) X.TP X.B \-t X.I tape option: This option can be used if all the file systems where dumped onto the same tape (as is the case with our daily "incremental" dumps.) If this option is used, then the tape name field should be omitted in the remainder of the call line. In addition, information about files that were on the tape before it was written over is deleted. X.TP X.B \-d X.I disable tape-check option: Single-character alphabetic tape names are forced to upper-case (this avoids entries for 'A' and 'a' when someone forgets to capitalize the 'a'). The 'd' option disables this forcing. X.TP X.B \-p X.I purge option: The next argument is taken as a tape name, and all references to this tape are purged from the file_system file. This is useful when the file accidentally gets trashed. X.TP X.B \-f X.I file option: The next argument is taken as the file_system file, instead of the default defined in "filtap.h". X.SH DESCRIPTION X.PP A backup record consists of the following information: X.TP X.B X.I inodes a number of inodes (varies depending on the number of backup records kept.) X.TP X.B X.I tapenames a number of tape names (varies depending on the number of backup records kept.) Length of tape name is determined by MAXTAPNAM in "filtap.h". X.TP X.B X.I dirflag flag indicating if current entry is a directory entry or normal file entry. (1 byte, '0' means normal entry, '1' means directory entry.) X.TP X.B X.I filename actual name of file or directory. (ie. if file is "/u/foo/bar" then the file name would be "bar") X.PP The number of inodes and tape names kept can vary depending on the number of backup records kept. The number of backup records is determined by the constant MAXBACKUPS in the include file "filtap.h". A directory consists of several entries. Directories are delimited by a unique marker record whose file name is "/". So a directory consists of a "." and ".." entry followed by any number of file entries (some of which may be directories) and eventually ending with a marker ("/") entry. Directories are recursively descended as they are encountered. By enabling the summary information (with the -s option) all of the entries in the file should be accounted for. X.PP The summary information consists of the following: X.TP X.B Total Number of entries in file (/g/etc/filesontapes). X.I . The number of entries is the sum of the directory entires, the "." and ".." entries, the directory marker entries, and the file entries. X.TP X.B Number of directory entries. X.I . For example, in the file /usr/foo/bar the directory entries would be /usr and /usr/foo. Each of these directories would have "." & ".." entries. This number X.I does not include the "." and ".." entries as directories. X.TP X.B Number of file entries. X.I . This represents all the non-directory and non-"dot" and non-"dotdot" entries. X.TP X.B Number of marker entries. X.I . This represents the number of entries. A marker entry is placed after each directory to mark the end of a directories entires. (This number is typically 1 more than the number of directory entries.) X.TP X.B Number of "." and ".." entries. X.I . What more can be said. For each directory there are a "." and ".." entry. This number tells how many of them there are. X.SH EXAMPLES X.B filtapmgr \-st A /usr /tmp/dumpdir.usr /g /tmp/dumpdir.g / /tmp/dumpdir X.br X.B filtapmgr \-v /g /tmp/dumpdir.g C /usr /tmp/dumpdir.usr D / /tmp/dumpdir E X.br X.B filtapmgr / dumpdir A X.br X.B filtapmgr \-vsp H X.br X.B filtapmgr \-f /usr/foobar -vsdt i /u /tmp/dumpdir.u X.SH FILES USED X/g/etc/filesontapes X.SH AUTHOR Original design by Patrick Steranka (patrick@umcp-cs) X.B University of Maryland, College Park X.br Added to and currently maintained by Pete Cottrell (petec@umcp-cs) X.B University of Maryland, College Park X.SH BUGS The epoch dumpdir files can be VERY large, so don't use filtapmgr with them (unless you can afford the space to be taken by the file_system file). X.br The '.' entries are not guaranteed to be accurate, although they usually are. This is because the dumpdir program's output does not always have '.' entries for each directory dumped, but there is a '.' entry in the file_system file for every directory. X.br Currently, old information is only deleted when the 't' option is given. If it isn't given, and you want to get rid of old information, you must run filtapmgr with the 'p' option. The one good thing about this is that there is a way to update the file_system file without deleting information, whether or not it is old. //go.sysin dd * made=TRUE if [ $made = TRUE ]; then /bin/chmod 644 filtapmgr.8 /bin/echo -n ' '; /bin/ls -ld filtapmgr.8 fi /bin/echo 'Extracting makefile' sed 's/^X//' <<'//go.sysin dd *' >makefile CFLAGS= -O filtapmgr: filtapmgr.c filtap.h cc $(CFLAGS) -o filtapmgr filtapmgr.c whichtape: whichtape.c getrecord.o timdmptap.o filtap.h cc $(CFLAGS) -o whichtape getrecord.o timdmptap.o whichtape.c //go.sysin dd * made=TRUE if [ $made = TRUE ]; then /bin/chmod 644 makefile /bin/echo -n ' '; /bin/ls -ld makefile fi /bin/echo 'Extracting whichtape.1' sed 's/^X//' <<'//go.sysin dd *' >whichtape.1 X.TH WHICHTAPE 1L "Univ. of Maryland" X.UC 4 X.SH NAME whichtape \- determine if file has been backed-up on system tape. X.SH SYNOPSIS X.B whichtape [ X.B \-f file_system file ] [ X.B \-arie ] file list X.SH INTRODUCTION X.I Whichtape is used to determine if there is a system back-up for a file or list of files. For each file in the list, the name of the tape upon which the file can be found is printed, along with the time and date when the backup was made. The corresponding file name is also printed. If the file name given is a directory, then all the files in that directory will be printed. The X.I -r (recursive option) is available, if you wish to also see sub-directories from a give directory. X.SH OPTIONS The following options are available. X.TP 12n X.B \-a X.I all option: The name of the tape that contains the X.I most recent copy of a file is printed (by default). The X.I -a option causes all backup information to be printed. Currently there are 3 records of backup information kept. What this means to the user is that the latest 3 system backups are known. X.TP X.B \-i X.I inode option: This option causes the inodes of the files to be printed along with the tape and file names. The inode number can be used to restore the file, is usually of no importance to the general user. X.TP X.B \-r X.I recursive option: This option causes sub-directories to be descended recursively and files in the sub-directories listed. By default, only the files in a directory are listed. X.TP X.B \-e X.I no-expand: The -e option is not very likely to be used, however, it is useful in some circumstances. By default, if a file name is given (ie. /usr/foo), but it is not found, then the file name is expanded (ie. /usr/foo/.) and again looked for. This expansion allows the user to not have to remember to type the dot, when the user is refering to a directory. However, a conflict can occur if the user is looking for a file, but only the directory of the same name exists. For example, suppose the file /usr/foo/bar is wanted, but it has not been backed-up, and suppose a directory of the same name has been backed-up. If the user types "whichtape /usr/foo/bar", the user will get a listing of the directory /usr/foo/bar, unless the -e (no expansion option) is given. If the -e option is given, a message will be printed telling the user that the file requested has not been backed up. This option prevents this expansion from occurring. (Note: The files X/usr/foo and /usr/foo/. are different. This distinction is necessary, please, be aware of it!) X.TP X.B \-f X.I alternate file: The next argument is taken as the file_system file, instead of the default defined in "filtap.h". X.SH FILES X/g/etc/filesontapes (defined in "filtap.h") X.br X/etc/dumpdates X.br X/etc/fstab X.SH SEE ALSO filtapmgr X.SH AUTHOR Original designed by Patrick Steranka (patrick@umcp-cs) X.br University of Maryland, College Park X.br Currently maintained by Pete Cottrell (petec@umcp-cs) X.br University of Maryland, College Park X.SH BUGS Losing files is a drag. Restoring is a pain. //go.sysin dd * made=TRUE if [ $made = TRUE ]; then /bin/chmod 644 whichtape.1 /bin/echo -n ' '; /bin/ls -ld whichtape.1 fi /bin/echo 'Extracting update' sed 's/^X//' <<'//go.sysin dd *' >update # # This script is used after a daily dump to get the necessary information # to update the files on tape information. The argument should be the name # of the dump tape. # if ($#argv != 1) goto usage; dumpdir f /dev/rmt12 >! /tmp/dumpdir.usr ; mt fsf dumpdir f /dev/rmt12 >! /tmp/dumpdir; mt fsf dumpdir >! /tmp/dumpdir.g; mt offl echo 'Updating file systems: files on tape information ' filtapmgr -vst $argv[1] /usr /tmp/dumpdir.usr / /tmp/dumpdir /g /tmp/dumpdir.g >&! /g/petec/report exit(0); usage: echo 'usage: /etc/update <tape name>' exit(1); //go.sysin dd * made=TRUE if [ $made = TRUE ]; then /bin/chmod 755 update /bin/echo -n ' '; /bin/ls -ld update fi -- Call-Me: Pete Cottrell, Univ. of Md. Comp. Sci. Dept. UUCP: {seismo,allegra,brl-bmd}!umcp-cs!petec CSNet: petec@umcp-cs ARPA: petec.umcp-cs@CSNet-Relay