Amanda-Users

Re: more restore problems with tape spanning...

2007-07-06 08:27:25
Subject: Re: more restore problems with tape spanning...
From: Jean-Louis Martineau <martineau AT zmanda DOT com>
To: Jean-Francois Malouin <Jean-Francois.Malouin AT bic.mni.mcgill DOT ca>
Date: Fri, 06 Jul 2007 08:15:24 -0400
Try the attached patch with amfetchdump, it included the previous patch.

Jean-Louis

Jean-Francois Malouin wrote:
* Jean-Francois Malouin <Jean-Francois.Malouin AT bic.mni.mcgill DOT ca> 
[20070705 16:05]:
Hold on to answer this one Jean-Louis.
I think I've found the problem and I'm doing a amfetchdump run and it went through the first tape and resumed the
restore with the second tape.
I'll post later when it completes.

OK here it goes: I had somehow 2 config recompiled most probably
without doing a 'make distclean' between the configure. The hint was that the debug files for this one were not located in the right place and once I found them I realized that amfetchdump could not find the chg-zd-mtx script.

The amfetchdump debug file (in /tmp/amanda-spantest/server/stk_80-conf2
it should have been /tmp/amanda-conf2/server/stk_80-conf2):

...
search_tapes(prompt_out=2, prompt_in=0,  use_changer=1, tapelist=100873f8, 
match_list=10025758, flags=10016550, features=0)
<error> could not exec "/opt/amanda/spantest/libexec/chg-zd-mtx": No such file 
or directory
changer: got exit: 1 str: <error> could not read result from 
"/opt/amanda/spantest/libexec/chg-zd-mtx"
num_entries(tapelist=100873f8)=7
<error> could not exec "/opt/amanda/spantest/libexec/chg-zd-mtx": No such file 
o r directory
changer: got exit: 1 str: <error> could not read result from 
"/opt/amanda/spantest/libexec/chg-zd-mtx"


So I recompiled making sure to start with a clean slate and now I get:


# /opt/amanda/amanda2/sbin/amfetchdump -p -a stk_80-conf2 \
yorick /data/ipl/ipl10 20070630 | /usr/freeware/bin/tar -xpf -
7 tape(s) needed for restoration
cc
dd (null)
The following tapes are needed: stk_40-conf2-000017 stk_40-conf2-000018
stk_40-conf2-000019 stk_40-conf2-000020 stk_40-conf2-000014
stk_40-conf2-000015 stk_40-conf2-000001
ee (null)
ff /hw/tape/tps22d2nrnsv
gg /hw/tape/tps22d2nrnsv
Label mismatch, got stk_40-conf2-000018 and expected stk_40-conf2-000017
hh /hw/tape/tps22d2nrnsv
Looking for tape stk_40-conf2-000017...
amfetchdump: slot 26: date 20070630 label stk_40-conf2-000017 (exact label 
match)
ii /hw/tape/tps22d2nrnsv
Scanning stk_40-conf2-000017 (slot 26)
amfetchdump: 14: restoring split dumpfile: date 20070630 host yorick disk 
/data/ipl/ipl10 part 1/UNKNOWN lev 0 comp N program /usr/freeware/bin/tar
amfetchdump: 15: restoring split dumpfile: date 20070630 host yorick disk 
/data/ipl/ipl10 part 2/UNKNOWN lev 0 comp N program /usr/freeware/bin/tar
amfetchdump: Search of stk_40-conf2-000017 complete
gg /hw/tape/tps22d2nrnsv
Label mismatch, got stk_40-conf2-000017 and expected stk_40-conf2-000018
hh /hw/tape/tps22d2nrnsv
Looking for tape stk_40-conf2-000018...
amfetchdump: slot 28: date 20070630 label stk_40-conf2-000018 (exact label 
match)
ii /hw/tape/tps22d2nrnsv
Scanning stk_40-conf2-000018 (slot 28)
amfetchdump: 1: restoring split dumpfile: date 20070630 host yorick disk 
/data/ipl/ipl10 part 3/UNKNOWN lev 0 comp N program /usr/freeware/bin/tar
amfetchdump: 2: restoring split dumpfile: date 20070630 host yorick disk 
/data/ipl/ipl10 part 4/UNKNOWN lev 0 comp N program /usr/freeware/bin/tar
amfetchdump: 3: restoring split dumpfile: date 20070630 host yorick disk 
/data/ipl/ipl10 part 5/UNKNOWN lev 0 comp N program /usr/freeware/bin/tar
amfetchdump: 4: restoring split dumpfile: date 20070630 host yorick disk 
/data/ipl/ipl10 part 6/UNKNOWN lev 0 comp N program /usr/freeware/bin/tar
amfetchdump: 5: restoring split dumpfile: date 20070630 host yorick disk 
/data/ipl/ipl10 part 7/UNKNOWN lev 0 comp N program /usr/freeware/bin/tar
amfetchdump: 6: restoring split dumpfile: date 20070630 host yorick disk 
/data/ipl/ipl10 part 8/UNKNOWN lev 0 comp N program /usr/freeware/bin/tar
amfetchdump: 7: restoring split dumpfile: date 20070630 host yorick disk 
/data/ipl/ipl10 part 9/UNKNOWN lev 0 comp N program /usr/freeware/bin/tar
amfetchdump: 8: restoring split dumpfile: date 20070630 host yorick disk 
/data/ipl/ipl10 part 10/UNKNOWN lev 0 comp N program /usr/freeware/bin/tar
amfetchdump: 9: restoring split dumpfile: date 20070630 host yorick disk 
/data/ipl/ipl10 part 11/UNKNOWN lev 0 comp N program /usr/freeware/bin/tar
amfetchdump: 10: restoring split dumpfile: date 20070630 host yorick disk 
/data/ipl/ipl10 part 12/UNKNOWN lev 0 comp N program /usr/freeware/bin/tar
amfetchdump: 11: restoring split dumpfile: date 20070630 host yorick disk 
/data/ipl/ipl10 part 13/UNKNOWN lev 0 comp N program /usr/freeware/bin/tar
amfetchdump: error reading file header: No space left on device
amfetchdump: Search of stk_40-conf2-000018 complete

/usr/freeware/bin/tar: Unexpected EOF in archive
/usr/freeware/bin/tar: Unexpected EOF in archive

/usr/freeware/bin/tar: Error is not recoverable: exiting now

amfetchdump.*.debug attached.

jf

------------------------------------------------------------------------

amfetchdump: debug 1 pid 55243191 ruid 0 euid 0: start at Thu Jul  5 16:53:09 
2007
amfetchdump: debug 1 pid 55243191 ruid 666 euid 666: rename at Thu Jul  5 
16:53:09 2007
append_to_tapelist(tapelist=0, label='stk_40-conf2-000017', , file=15, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000017', , file=14, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000018', , file=11, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000018', , file=10, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000018', , file=9, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000018', , file=8, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000018', , file=7, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000018', , file=6, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000018', , file=5, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000018', , file=4, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000018', , file=3, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000018', , file=2, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000018', , file=1, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000019', , file=11, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000019', , file=10, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000019', , file=9, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000019', , file=8, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000019', , file=7, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000019', , file=6, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000019', , file=5, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000019', , file=4, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000019', , file=3, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000019', , file=2, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000019', , file=1, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000020', , file=10, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000020', , file=9, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000020', , file=8, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000020', , file=7, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000020', , file=6, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000020', , file=5, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000020', , file=4, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000020', , file=3, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000020', , file=2, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000020', , file=1, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000014', , file=10, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000014', , file=9, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000014', , file=8, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000014', , file=7, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000014', , file=6, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000014', , file=5, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000014', , file=4, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000014', , file=3, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000014', , file=2, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000014', , file=1, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000015', , file=10, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000015', , file=9, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000015', , file=8, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000015', , file=7, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000015', , file=6, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000015', , file=5, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000015', , file=4, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000015', , file=3, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000015', , file=2, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000015', , file=1, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000001', , file=2, 
isafile=0)
append_to_tapelist(tapelist=10089998, label='stk_40-conf2-000001', , file=1, 
isafile=0)
search_tapes(prompt_out=2, prompt_in=0,  use_changer=1, tapelist=10089998, 
match_list=10025788, flags=10016570, features=0)
num_entries(tapelist=10089998)=7
changer_query: changer return was 20 1 1
changer_query: searchable = 1
changer_find: looking for stk_40-conf2-000017 changer is searchable = 1
changer_search: stk_40-conf2-000017
search_a_tape: desired_tape=10089998 label=stk_40-conf2-000017
tape:   numfiles = 2
tape:   files[0] = 14
tape:   files[1] = 15
current tapefile_idx = 0
changer_query: changer return was 20 1 1
changer_query: searchable = 1
changer_find: looking for stk_40-conf2-000018 changer is searchable = 1
changer_search: stk_40-conf2-000018
search_a_tape: desired_tape=10088920 label=stk_40-conf2-000018
tape:   numfiles = 11
tape:   files[0] = 1
tape:   files[1] = 2
tape:   files[2] = 3
tape:   files[3] = 4
tape:   files[4] = 5
tape:   files[5] = 6
tape:   files[6] = 7
tape:   files[7] = 8
tape:   files[8] = 9
tape:   files[9] = 10
tape:   files[10] = 11
current tapefile_idx = 0

diff -u -r --show-c-function --new-file 
--exclude-from=/home/martinea/src.orig/amanda.diff 
--ignore-matching-lines='$Id:' amanda-2.5.2p1.orig/restore-src/amrestore.c 
amanda-2.5.2p1.restore/restore-src/amrestore.c
--- amanda-2.5.2p1.orig/restore-src/amrestore.c 2007-05-04 07:39:06.000000000 
-0400
+++ amanda-2.5.2p1.restore/restore-src/amrestore.c      2007-07-06 
08:09:09.000000000 -0400
@@ -400,21 +401,6 @@ main(
     if(isafile) {
        close(tapedev);
     } else {
-       /*
-        * See the notes above about advancing to the next file.
-        */
-       if(read_result == 0) {
-           tapefd_close(tapedev);
-           if((tapedev = tape_open(tapename, 0)) < 0) {
-               error("could not open %s: %s", tapename, strerror(errno));
-               /*NOTREACHED*/
-           }
-       } else {
-           if(tapefd_fsf(tapedev, (off_t)1) < 0) {
-               error("could not fsf %s: %s", tapename, strerror(errno));
-               /*NOTREACHED*/
-           }
-       }
        tapefd_close(tapedev);
     }
 
Binary files 
amanda-2.5.2p1.orig/restore-src/kdc.localdomain._boot.20070705073106.0.001 and 
amanda-2.5.2p1.restore/restore-src/kdc.localdomain._boot.20070705073106.0.001 
differ
diff -u -r --show-c-function --new-file 
--exclude-from=/home/martinea/src.orig/amanda.diff 
--ignore-matching-lines='$Id:' amanda-2.5.2p1.orig/restore-src/restore.c 
amanda-2.5.2p1.restore/restore-src/restore.c
--- amanda-2.5.2p1.orig/restore-src/restore.c   2007-06-06 19:19:20.000000000 
-0400
+++ amanda-2.5.2p1.restore/restore-src/restore.c        2007-07-06 
08:02:06.000000000 -0400
@@ -1550,6 +1550,7 @@ search_a_tape(
                    send_message(prompt_out, flags, their_features,
                                 "could not open %s: %s",
                                 cur_tapedev, strerror(errno));
+                   break;
                    error("could not open %s: %s",
                          cur_tapedev, strerror(errno));
                    /*NOTREACHED*/
@@ -1561,6 +1562,7 @@ search_a_tape(
                    send_message(prompt_out, flags, their_features,
                                 "Could not fsf device %s: %s",
                                 cur_tapedev, strerror(errno));
+                   break;
                    error("Could not fsf device %s: %s",
                          cur_tapedev, strerror(errno));
                    /*NOTREACHED*/
@@ -1577,6 +1579,7 @@ search_a_tape(
                                     OFF_T_FMT ": %s",
                                     cur_tapedev, (OFF_T_FMT_TYPE)fsf_by,
                                     strerror(errno));
+                       break;
                        error("Could not fsf device %s by " OFF_T_FMT ": %s",
                              cur_tapedev, (OFF_T_FMT_TYPE)fsf_by,
                              strerror(errno));
@@ -1592,6 +1595,8 @@ search_a_tape(
        if(isafile)
            break;
         *read_result = read_file_header(file, tapefd, isafile, flags);
+       if (file->type == F_UNKNOWN)
+           break;
 
        /* only restore a single dump, if piping to stdout */
        if (!headers_equal(prev_rst_file, file, 1) &&
@@ -1600,29 +1605,11 @@ search_a_tape(
        }
     } /* while we keep seeing headers */
 
-    if (!isafile) {
-       if (file->type == F_EMPTY) {
-           aclose(tapefd);
-           if((tapefd = tape_open(cur_tapedev, 0)) < 0) {
-               send_message(prompt_out, flags, their_features,
-                            "could not open %s: %s",
-                            cur_tapedev, strerror(errno));
-               error("could not open %s: %s",
-                     cur_tapedev, strerror(errno));
-               /*NOTREACHED*/
-           }
-       } else {
-           if (tapefd_fsf(tapefd, (off_t)1) < 0) {
-               send_message(prompt_out, flags, their_features,
-                            "could not fsf %s: %s",
-                            cur_tapedev, strerror(errno));;
-               error("could not fsf %s: %s",
-                     cur_tapedev, strerror(errno));
-               /*NOTREACHED*/
-           }
-       }
+    if (isafile) {
+       close(tapefd);
+    } else {
+       tapefd_close(tapefd);
     }
-    tapefd_close(tapefd);
 
     /* spit out our accumulated list of dumps, if we're inventorying */
     if (logstream) {
@@ -1924,7 +1911,8 @@ search_tapes(
        if (desired_tape) desired_tape = desired_tape->next;
 
        /* only restore a single dump, if piping to stdout */
-       if (!headers_equal(&prev_rst_file, &file, 1) &&
+       if (file.type != F_UNKNOWN &&
+           !headers_equal(&prev_rst_file, &file, 1) &&
            flags->pipe_to_fd == fileno(stdout))
                break;