3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
8 # Run a simple backup of the Bacula build directory then create some
9 # new files, do an Incremental and restore those two files.
11 # This script uses the virtual disk autochanger and two drives
13 TestName="2drive-incremental-2disk"
18 scripts/copy-2disk-drive-confs
19 scripts/prepare-disk-changer
22 change_jobname localhost-fd $JobName
25 echo "${cwd}/tmp/build" >${cwd}/tmp/file-list
26 if test ! -d ${cwd}/tmp/build ; then
27 mkdir -p ${cwd}/tmp/build
29 cp -p ${cwd}/build/src/dird/*.c ${cwd}/tmp/build
31 echo "${cwd}/tmp/build/ficheriro1.txt" >restore-list
32 echo "${cwd}/tmp/build/ficheriro2.txt" >>restore-list
35 # Turn off Prefer Mounted Volumes so we use 2 drives
36 outf="${cwd}/tmp/sed_tmp"
37 echo "s%# Prefer Mounted Volumes% Prefer Mounted Volumes%g" >${outf}
38 cp ${cwd}/bin/bacula-dir.conf ${cwd}/tmp/1
39 # Comment the next line out to write everything to one drive
40 # otherwise, it writes the two jobs to different drives
41 sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-dir.conf
43 # Write out bconsole commands
44 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
47 @$out ${cwd}/tmp/log1.out
49 setdebug level=3 storage=tape
50 setdebug level=3 client=2drive2disk
51 label storage=tape volume=TestVolume001 slot=1 Pool=Default drive=0
52 label storage=tape volume=TestVolume002 slot=2 Pool=Default drive=1
54 setdebug level=200 storage=tape
55 run job=NightlySave yes
56 run job=NightlySave yes
57 run job=NightlySave yes
58 run job=NightlySave yes
59 run job=NightlySave yes
74 echo "ficheriro1.txt" >${cwd}/tmp/build/ficheriro1.txt
75 echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt
78 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
81 @$out ${cwd}/tmp/log1.out
82 @# Force Incremental on the second Volume
83 update volume=TestVolume001 VolStatus=Used
86 @#setdebug level=120 storage=tape
87 run level=Incremental job=NightlySave yes
95 @$out ${cwd}/tmp/log2.out
96 restore where=${cwd}/tmp/bacula-restores
98 <${cwd}/tmp/restore-list
108 check_for_zombie_jobs storage=tape
113 # The restore should read from TestVolume002, which was on drive 1
114 grep TestVolume002 ${cwd}/tmp/log2.out >/dev/null 2>&1
115 # Note rstat may already be set, so we don't just store into it
116 if [ $? != 0 ] ; then
121 # Delete .c files because we will only restored the txt files
123 rm -f ${cwd}/tmp/build/*.c
124 check_restore_tmp_build_diff