3 # Copyright (C) 2000-2017 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
6 # Run a two backup of the Bacula build directory + other files
7 # then restore one file and see if we have restore problems
8 # We need a large directory to store the volume
11 # The main goal is to have the following layout on the volume
13 # JobMedia <-----------------
21 # JobMedia <-----------------
25 TestName="restore-multi-session-test"
33 # Zap out any schedule in default conf file so that
34 # it doesn't start during our test
37 echo "s% Schedule =%# Schedule =%g" >${outf}
38 cp $scripts/bacula-dir.conf $tmp/1
39 sed -f ${outf} $tmp/1 >$scripts/bacula-dir.conf
41 $bperl -e "add_attribute('$conf/bacula-sd.conf', 'MaximumFileSize', '500MB', 'Device')"
42 $bperl -e "add_attribute('$conf/bacula-dir.conf', 'MaximumVolumeBytes', '10GB', 'Pool')"
43 $bperl -e "add_attribute('$conf/bacula-dir.conf', 'Label Format', 'Vol-', 'Pool', 'Default')"
44 $bperl -e "add_attribute('$conf/bacula-dir.conf', 'FileSet', 'FewFiles', 'Job', 'BackupClient1')"
45 $bperl -e "add_attribute('$conf/bacula-dir.conf', 'MaximumConcurrentJobs', 10, 'Job')"
46 $bperl -e "add_attribute('$conf/bacula-dir.conf', 'MaximumConcurrentJobs', 10, 'Client')"
47 $bperl -e "add_attribute('$conf/bacula-dir.conf', 'MaximumConcurrentJobs', 10, 'Storage')"
48 $bperl -e "add_attribute('$conf/bacula-sd.conf', 'MaximumConcurrentJobs', 10, 'Device')"
49 $bperl -e "add_attribute('$conf/bacula-sd.conf', 'CommCompression', 'no', 'Storage')"
50 $bperl -e "add_attribute('$conf/bacula-dir.conf', 'CommCompression', 'no', 'Director')"
51 $bperl -e "add_attribute('$conf/bacula-fd.conf', 'CommCompression', 'no', 'FileDaemon')"
52 $bperl -e "add_attribute('$conf/bacula-sd.conf', 'MaximumPartSize', '50MB', 'Device')"
54 #$bperl -e "add_attribute('$conf/bacula-dir.conf', 'SpoolData', 'Yes', 'Job', 'BackupClient1')"
55 #$bperl -e "add_attribute('$conf/bacula-sd.conf', 'MaximumSpoolSize', '200MB', 'Device')"
57 change_jobname BackupClient1 $JobName
60 # If available, compress files on the FS, we will store only 0
61 if [ "$FORCE_CLOUD" = "" ]; then
62 touch $tmp/Vol-0001 $tmp/Vol-0002
64 # might not be available
65 chattr +c $tmp/Vol-0001 2> /dev/null
66 chattr +c $tmp/Vol-0002 2> /dev/null
69 cat >> $conf/bacula-dir.conf <<EOF
73 # start with some small files
74 File = "$cwd/build/po"
78 File = "$cwd/build/src"
82 director=`$bperl -e "get_dirname()"`
85 dd if=/dev/zero of=$tmp/0.dat count=1 obs=500M seek=1
86 dd if=/dev/zero of=$tmp/1.dat count=1 obs=500M seek=1
87 dd if=/dev/zero of=$tmp/2.dat count=1 obs=500M seek=1
90 cat <<END_OF_DATA >$tmp/bconcmds
94 setbandwidth limit="82400 kb/s" client
95 run job=$JobName storage=File1 level=full yes
97 run job=$JobName storage=File1 level=full yes
99 llist jobmedia jobid=1
105 cat <<END_OF_DATA >$tmp/bconcmds
110 setdebug level=500 trace=1 storage=File1
111 restore where=$tmp/bacula-restores
118 @exec "sh -c 'cp $working/*.restore.1.bsr $working/restore1.bsr'"
127 check_for_zombie_jobs storage=File1
132 cat $tmp/1.dat | md5sum > $tmp/1.dat.sum
133 cat $tmp/bacula-restores/$tmp/1.dat | md5sum > $tmp/1.dat.sum2
135 diff $tmp/1.dat.sum $tmp/1.dat.sum2