From mrc@mailgate.imagination.co.uk  Wed Nov 20 08:45:34 2002
Return-Path: <mrc@mailgate.imagination.co.uk>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 964F937B401
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 20 Nov 2002 08:45:34 -0800 (PST)
Received: from mailgate.imagination.co.uk (mailgate.imagination.co.uk [212.140.144.32])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 7E2A843E75
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 20 Nov 2002 08:45:33 -0800 (PST)
	(envelope-from mrc@mailgate.imagination.co.uk)
Received: (from mrc@localhost)
	by mailgate.imagination.co.uk (8.9.3/8.9.3) id QAA96665;
	Wed, 20 Nov 2002 16:45:21 GMT
Message-Id: <200211201645.QAA96665@mailgate.imagination.co.uk>
Date: Wed, 20 Nov 2002 16:45:21 GMT
From: mike.curtis@imagination.com
Reply-To: mike.curtis@imagination.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: multi-volume dump has restore fail          
X-Send-Pr-Version: 3.2

>Number:         45530
>Category:       bin
>Synopsis:       multi-volume dump has restore fail
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Nov 20 08:50:01 PST 2002
>Closed-Date:    Fri Dec 06 20:54:11 PST 2002
>Last-Modified:  Fri Dec 06 20:54:11 PST 2002
>Originator:     Mike Curtis
>Release:        FreeBSD 4.5-RELEASE (TESTARKMRC) #3: Sat Aug 31 16:05:12 GMT 2002
>Organization:
Imagination Ltd.
>Environment:

Dell PowerEdge 6450, 1Gbyte ECC RAM
FreeBSD 4.5-RELEASE
dump and restore versions as shipped with FreeBSD 4.5

>Description:

I have a RAID enclosure with 2 x 600Gbyte logical drives. I use one for the
company's work, and the other as a 'spare' of sorts. 

Backup of work is obviously my prime concern.

I'm using dump to create multiple 35Gbyte files on the 'spare' disk at night,
then cut these files to DLT tape during the day.

I do this for two reasons:

i) Since 95% of our restores are for 'stupidity recovery', it makes sense to
dump them 'close by' and then restore any 'lost' files interactively using
restore -v -i -f .....

ii) This spare-disk method gives me a week's window in which to cut (using dd
 - haven't got that far yet because of this bug) at the very least Friday's
multiple 'full' dump files to DLT tapes, without the need for an expensive
autochanger or jukebox affair.

Dump appears to work fine. However, interactive restore fails across these
multiple dump files.

>How-To-Repeat:

Repeatable known-bad example:

get virgin file system eg /dev/da1s1a
mount it on eg /mnt
make four files on it like this:
        mount /dev/da1s1a
        cd /mnt
        dd if=/dev/urandom of=hello1 bs=1k count=1k
        dd if=/dev/urandom of=hello2 bs=1k count=1k
        dd if=/dev/urandom of=hello3 bs=1k count=1k
        dd if=/dev/urandom of=hello4 bs=1k count=1k
        umount /mnt

Make the dump:

        cd /tmp/testdump
        dump -0 -B 2048 -f 1,2,3,4 /dev/da1s1a

this makes four dump format files

when you try to restore it goes wrong:
        restore -i -v -f 1
        restore > ls
        ... 5 hello3 ...
        restore > add hello3
        restore > extract

If we try the restore in order:
        Specify next volume: 1
        (tape name) 1

        2
        2
We get this error:
        resync restore, skipped 51 blocks

        3
        3

You don't get your file back!

hello3 starts somewhere in file '2'

I believe that the bug is in restore rather than dump because
if you do

        cat 1 2 3 > 123
        restore -i -v -f 123

you can get your file 'hello3' back; however, I don't want to
waste any time potentially having to cat multiple 35Gbyte files
together in an emergency, plus further testing of this produced
differing results.

Here's the script I actually use:

# dodiffbakdisk1
# 7-day differential backups using dump, full on Saturday
# mrc/imagination/06.08.2002

set -e
set -x

DOW=`/bin/date -u +%A`
STAMP="`/bin/date -u +%Y%m%d%H%M%S`__$$"
TAG=dodiffbakdisk1
DUMP=/sbin/dump
DATE=`/bin/date -u +%Y%m%d%H%M%S`
BACKMEUP=/disk/1

# mrc/imagination/23.10.2002: specify multiple 35Gbyte volumes, dump only uses
#       as many as it needs. Filesystem is 600Gbytes, so need 18:

BACKUPFILE="bigbox__disk_1__${DATE}_dump.1,bigbox__disk_1__${DATE}_dump.2,\
bigbox__disk_1__${DATE}_dump.3,bigbox__disk_1__${DATE}_dump.4,\
bigbox__disk_1__${DATE}_dump.5,bigbox__disk_1__${DATE}_dump.6,\
bigbox__disk_1__${DATE}_dump.7,bigbox__disk_1__${DATE}_dump.8,\
bigbox__disk_1__${DATE}_dump.9,bigbox__disk_1__${DATE}_dump.10,\
bigbox__disk_1__${DATE}_dump.11,bigbox__disk_1__${DATE}_dump.12,\
bigbox__disk_1__${DATE}_dump.13,bigbox__disk_1__${DATE}_dump.14,\
bigbox__disk_1__${DATE}_dump.15,bigbox__disk_1__${DATE}_dump.16,\
bigbox__disk_1__${DATE}_dump.17,bigbox__disk_1__${DATE}_dump.18"

OPTIONS="-u -B 36700160 -f"

case $DOW in
Saturday)       level=0;;
Sunday)         level=1;;
Monday)         level=1;;
Tuesday)        level=1;;
Wednesday)      level=1;;
Thursday)       level=1;;
Friday)         level=1;;
*)              exit 1;;
esac

CMD="$DUMP -$level $OPTIONS $BACKUPFILE $BACKMEUP"

logger -t $TAG start $STAMP
$CMD > /tmp/log/dump__$STAMP 2>&1
logger -t $TAG stop $STAMP

# end

>Fix:

Don't know, need help.

Our version of restore has tape.c 1.16.2.6 2001/08/01

.... and it looks like there may be an issue with this already:

http://www.freebsd.org/cgi/cvsweb.cgi/src/sbin/restore/tape.c.diff?r1=1.16.2.6&r2=1.16.2.7&only_with_tag=RELENG_4&f=h

Any help much appreciated: big project deadline looming, can't finish without
multiple test bare-metal recoveries!!!

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: iedowse 
State-Changed-When: Thu Nov 28 17:32:02 PST 2002 
State-Changed-Why:  

As you found out with cvsweb, a number of multi-volume restore bugs 
have been fixed since 4.5-RELEASE. Can you try either updating to 
a newer release or else downloading the newer version of tape.c and 
then recompiling restore? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=45530 
State-Changed-From-To: feedback->closed 
State-Changed-By: iedowse 
State-Changed-When: Fri Dec 6 20:53:20 PST 2002 
State-Changed-Why:  

The submitter confirmed that this is fixed in 4.7-RELEASE. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=45530 
>Unformatted:
