1#!/bin/sh 2# 3# Run a simple backup then create some 4# new files, do an Incremental and restore those two files. 5# 6# This script uses the virtual disk autochanger and two drives 7# 8TestName="2drive-2disk" 9JobName="2drive2disk" 10 11# Directory to backup. 12# This directory will be created by setup_data(). 13BackupDirectory="${tmp}/data" 14 15. scripts/functions 16 17scripts/cleanup 18 19# Use a tgz to setup data to be backuped. 20# Data will be placed at "${tmp}/data/". 21setup_data data/small.tgz 22 23scripts/copy-2disk-drive-confs 24scripts/prepare-disk-changer 25 26CLIENT=2drive2disk 27 28change_jobname localhost-fd $JobName 29start_test 30 31# the default fileset FS_TESTJOB backups all file and directories defined in "${tmp}/file-list". 32echo "${BackupDirectory}" >${tmp}/file-list 33 34# Turn off Prefer Mounted Volumes so we use 2 drives 35outf="${cwd}/tmp/sed_tmp" 36echo "s%# Prefer Mounted Volumes% Prefer Mounted Volumes%g" >${outf} 37cp ${cwd}/bin/bareos-dir.conf ${cwd}/tmp/1 38# Comment the next line out to write everything to one drive 39# otherwise, it writes the two jobs to different drives 40sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bareos-dir.conf 41 42# Write out bconsole commands 43cat <<END_OF_DATA >${cwd}/tmp/bconcmds 44@$out /dev/null 45messages 46@$out ${cwd}/tmp/log1.out 47setdebug level=3 dir 48setdebug level=3 storage=tape 49setdebug level=3 client=$CLIENT 50label storage=tape volume=TestVolume001 slot=1 Pool=Default drive=1 51# label storage=tape volume=TestVolume002 slot=2 Pool=Default drive=1 52status storage=tape 53setdebug level=120 storage=tape 54run job=NightlySave level=Full yes 55@sleep 1 56run job=NightlySave level=Full yes 57@sleep 1 58run job=NightlySave level=Full yes 59@sleep 1 60run job=NightlySave level=Full yes 61@sleep 1 62run job=NightlySave level=Full yes 63@sleep 3 64status storage=tape 65wait 66list volumes 67list jobs 68status storage=tape 69messages 70quit 71END_OF_DATA 72 73run_bareos 74 75cat <<END_OF_DATA >${cwd}/tmp/bconcmds 76@$out /dev/null 77messages 78@$out ${cwd}/tmp/log1.out 79@# Force Incremental on the second Volume 80# update volume=TestVolume001 VolStatus=Used 81status storage=tape 82@#setdebug level=120 storage=tape 83run level=Incremental job=NightlySave yes 84wait 85list volumes 86status storage=tape 87messages 88@# 89@# now do a restore 90@# 91@$out ${cwd}/tmp/log2.out 92restore where=${cwd}/tmp/bareos-restores select all storage=tape done 93yes 94wait 95messages 96@output 97quit 98END_OF_DATA 99 100run_bconsole 101check_for_zombie_jobs storage=tape 102stop_bareos 103 104check_two_logs 105check_restore_diff 106 107end_test 108