dusan@batserver.cs.uq.oz.au (01/10/91)
I apologize in advance for taking some of time and space but I just feel that the solution to this problem might interest some of other people on the net. I did what I could and now I ask for help from network gurus. I have to emphasize that I have been carefully following all the newsgroups for about 10 months now and have not found a solution yet... I am trying to make "exetoc" (program written by Matt Landau) working. I have made it partly work, but not completely. It seems that my task is not an easy one! Would anybody be so kind to answer (any info would be more than welcome). By the way, what software you use for network-wide backups (home-made or public one)? Here is what my results show (bear in mind that I am talking about SparcStation 1+ with SunOS 4.1 and EXB-8200 attached to it): a. the original version of "exetoc" did not work at all b. the version which was mailed to me by Matt Landau which included the following additional lines in "smtops.c" worked partially: THE DIFF FILE FOR "smtops.c" (according to Matt's suggestions): 108,109d107 < #if DEVRSMT < 140d137 < #endif /* DEVRSMT */ 143d139 < 158c154 < #if !REMOTE && DEVRSMT --- > #if !REMOTE Then I did the following: 1. exetoc -t/dev/nrst1 -i (initialized the tape 2. mt -f /dev/nrst1 fsf 1 3. dump ... (three file systems for example: /usr/src/local, /, /usr) 4. exetoc /t/dev/nrst1 -ptestfile (put index on tape) 5. mt -f /dev/nrst1 rew 6. mt -f /dev/nrst1 fsf 1 (not needed, but anyway...) 7. restore ivf /dev/nrst1 Media read error: I/O error (exit code 1) All additional mt fsf fail... 8. mt -f /dev/nrst1 rew 9. mt -f /dev/nrst1 fsf 2 HERE I CAN READ SECOND DUMP FILE!!! AND FROM HERE I CAN EASILY DO FSF1 AGAIN AND READ THE THIRD DUMP FILE!!? This means that I can read my SECOND and THIRD dump on the tape, BUT NOT FIRST! Many times I have tried to see what was going on, and all the time I could not go to first dump file on the tape. It seems as though the TOC is overwriting its beginning. Do you have any idea why I can reach my second and third dump files but NOT FIRST! What might be the problem? I feel so excited to be close to having "exetoc" work on SunOS 4.1 and I would really like to see it happen. c. the third version (which included Steve Romig's suggestions, regarding "mt bsr 1, then close" did not help (or I maybe did not write the code properly). Actually, the result was the same as in case (b.): (Yes I thought about changing the size of TOC from 10 to 20MB and tested it also, but it did not help) LINES ADDED TO "stmops.c": ------------------------- /*smt_close_without_eof(): Rewind and close a tape device. * * This routine provides a rewind-and-close operation, which is * necessary to prevent the tape device driver from adding an EOF * mark to the tape if the last operation before closing the device * was a write. Since we are continutally rewriting the same file, * we need to inform the driver that we don't want a new EOF mark * every time we do so. */ void smt_close_without_eof(tapefd) int tapefd; { \ smt_bsr(tapefd); ------(ACTUALLY, I JUST CHANGED smt_rewind to smt_bsr!!) smt_close(tapefd); / } THE FOLLOWING LINES ARE COMPLETELLY NEW IN THIS FILE: * smt_bsr(): Do a single BSR * */ void smt_bsr(tapefd) int tapefd; { static struct mtop eof_op = { MTBSR, 1 }; if (ioctl(tapefd, MTIOCTOP, &eof_op) < 0) { perror("write bsr"); exit(EXIT_IO); } } LINE ADDED TO "smtops.h": ------------------------ extern void smt_bsr(); again I followed the same procedure as before to initialize the tape, do the dumps, and put toc on the tape... And again it did not work for the first dump... This time I wanted to see what was happening at the beginning of the tape so I did this: 1. exetoc -i 2. dd if=/dev/nrst1 of=/tmp/test ibs=62k 3. ls -als 10240 -rw-r--r-- 1 root 10475520 Jan 8 12:32 test (so, tape was initialized properly) 4. od -a test 0000000 [ E x e T O C sp T a b l e sp o f 0000020 sp C o n t e n t s ] nul nul nul nul nul nul 0000040 nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul * 47754000 (so far so good) 5. dump various file systems... 6. mt -f /dev/nrst1 rew 7. exetoc -t/dev/nrst1 -ptable_of_contents 8. mt -f /dev/nrst1 rew 9. dd if=/dev/nrst1 of=/tmp/toc_test 10. od -a /tmp/toc_test 0000000 [ E x e T O C sp T a b l e sp o f 0000020 sp C o n t e n t s ] nul nul nul nul nul nul 0000040 nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul * 0174000 T u e sp J a n sp sp 8 sp 1 2 : 4 0 0174020 : 1 6 sp E D T sp 1 9 9 1 nl C h e 0174040 c k i n g sp f i l e s y s t e m 0174060 s sp . . . nl nl S t a r t i n g sp * (some data about files.........................................) 0213220 e t o c . 1 nl l e a f sp sp sp sp sp 0213240 sp sp 3 6 3 ht . / . t o u c h f s 0213260 nl nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul 0213300 nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul * 0370000 (and this file is not 10MB! - it is much shorter now) So, it seems that it DOES NOT WRITE AN EOT IMMEDIATELLY AFTER THE TOC, BUT WRITES ONE A BIT LATER... AND I CAN NOT REACH THE REAL END OF THE 10MB FILE... Again, I can do "mt fsf 2" and go to second dump file... Maybe my code is not proper. Maybe my changes were not appropriate... Could you comment on it? To make things checked properly ( and again thanks to Steve Romig - he is a great man!) I did this: 1. mt -f /dev/nrst1 rew 2. exetoc -t/dev/nrst1 -i (initialize the tape again) 3. mt -f /dev/nrst1 fsf 1 4. dump f /dev/nrst1 /dev/sd0a 5. dump f /dev/nrst1 /dev/sd0d 6. dump f /dev/nrst1 /dev/sd0e 7. tcopy /dev/nrst1 file 1: eof after 0 records: 0 bytes eot total length: 0 bytes 8. mt -f /dev/nrst1 rew 9. tcopy /dev/nrst1 file 1: records 1 to 165: size 63488 file 1: eof after 165 records: 10475520 bytes file 2: records 1 to 41: size 10240 file 2: eof after 41 records: 419840 bytes file 3: records 1 to 12: size 10240 file 3: eof after 12 records: 122880 bytes file 4: records 1 to 9: size 10240 file 4: eof after 9 records: 92160 bytes eot total length: 11110400 bytes 10. mt -f /dev/nrst1 rew 11. exetoc -t/dev/nrst1 -ptoc_file (very small one, just for testing) 12. tcopy /dev/nrst1 file 1: records 1 to 2: size 63488 file 1: eof after 2 records: 126976 bytes eot total length: 126976 bytes 13. mt -f /dev/nrst1 rew 14. mt -f /dev/nrst1 fsf 2 15. tcopy /dev/nrst1 file 1: records 1 to 12: size 10240 file 1: eof after 12 records: 122880 bytes file 2: records 1 to 9: size 10240 file 2: eof after 9 records: 92160 bytes eot total length: 215040 bytes 16. mt -f /dev/nrst1 rew 17. mt -f /dev/nrst1 fsf 1 18. tcopy /dev/nrst1 file 1: eof after 0 records: 0 bytes eot total length: 0 bytes Obviously, additional eof makes a problem. I tried to get some reference for SCSI SunOS 4.1 st driver but so far no success. B. Solbourne 2/506 server with SunOS 4.0.3 The procedure was much the same as the one for SparcStation, except that in this case I received this error when I wanted to do Step 6... p# ./exetoc -t/dev/nrst1 -p/tmp/proba p# echo $? 0 p# mt -f /dev/nrst1 rew p# mt -f /dev/nrst1 rew p# mt -f /dev/nrst1 fsf 1 p# restore ivf /dev/nrst1 Verify tape and initialize maps Tape read error: I/O error p# mt -f /dev/nrst1 fsf 1 st1: space: CHECK: bn1: VENDOR UNIQUE(09): 00:..fatal /dev/nrst1 fsf 1 failed: I/O error p# mt -f /dev/nrst1 rew p# mt -f /dev/nrst1 fsf 2 st1: space: CHECK: bn1: VENDOR UNIQUE(09): 00:..fatal /dev/nrst1 fsf 2 failed: I/O error In this case I was not even allowed to fsf 2. So, I am really puzzled. If you have any idea, or just any other little thought about this I would appreciate it. PS. Have you REALLY ever heard of anybody who made "exetoc" work under SunOS 4.1? Have you ever tried to use "exetoc"? All the very best from warm and humid Brisbane, Dusan U. Baljevic The Department of Computer Science The University of Queensland 4072 - Australia ph. (07) 365 3239 Amateur Radio VK4FCW Inet: dusan@batserver.cs.uq.oz.au or dusan@uqcspe.cs.uq.oz.au