1#!/bin/sh 2# 3# Run a simple backup using the compressed option 4# then backup four times, each with incremental then 5# do a bscan and restore. 6# It should require at least 4 different bsrs. 7# 8TestName="bscan-fast-tape" 9JobName=bscanfasttape 10. scripts/functions 11 12require_tape_drive 13 14copy_tape_confs 15 16cp ${cwd}/bin/bareos-sd.conf ${cwd}/tmp/1 17# sed "s%# Maximum File Size% Maximum File Size%" ${cwd}/tmp/1 >${cwd}/bin/bareos-sd.conf 18 19change_jobname NightlySave $JobName 20 21 22# Directory to backup. 23# This directory will be created by setup_data(). 24BackupDirectory="${tmp}/data" 25 26# Use a tgz to setup data to be backuped. 27# Data will be placed at "${tmp}/data/". 28setup_data data/small.tgz 29 30start_test 31 32cat <<END_OF_DATA >tmp/bconcmds 33@$out /dev/null 34messages 35@$out tmp/log1.out 36setdebug level=2 storage=tape 37label storage=tape volume=TestVolume001 slot=0 pool=Default 38run job=$JobName yes 39wait 40messages 41quit 42END_OF_DATA 43 44echo "Starting Bareos tape writing" 45#$bin/btape -c bin/bareos-sd.conf /dev/nst0 <<END_OF_DATA 46#rewind 47#label 48#Test001 49#wr 50#wr 51#wr 52#wr 53#wr 54#wr 55#weof 56#quit 57#END_OF_DATA 58#run_bareos 59#check_for_zombie_jobs storage=tape 60#stop_bareos 61echo "End writing tape" 62 63# 64# now drop and recreate the database 65# 66cd bin 67./drop_bareos_tables >/dev/null 2>&1 68./make_bareos_tables >/dev/null 2>&1 69./grant_bareos_privileges 2>&1 >/dev/null 70cd .. 71 72echo "Begin attempt to read tape that crashes the system" 73echo "volume=TestVolume001" >tmp/bscan.bsr 74 75bscan_libdbi 76 77strace -o strace.new $bin/bscan -d200 -w working $BSCANLIBDBI -u regress -n regress -m -s -v -b tmp/bscan.bsr -c bin/bareos-sd.conf tape 78exit 79cat <<END_OF_DATA >tmp/bconcmds 80@$out /dev/null 81messages 82@$out tmp/log2.out 83@# 84@# now do a restore 85@# 86restore where=${cwd}/tmp/bareos-restores select all storage=tape done 87yes 88wait 89messages 90quit 91END_OF_DATA 92 93run_bareos 94check_for_zombie_jobs storage=tape 95stop_bareos 96#rm -f ${BackupDirectory}/src/lib/dummy 97 98check_two_logs 99check_restore_diff 100end_test 101