Tony Whitmore wrote:

Hi,

I've been working on using Bacula on our site (~500 PCs) for the last week or so, and have made great progress on test systems. I'll be backing up about 7 or 8 servers once it's all up and running.

On the "proper" backup system I will be using 200GB USB2 external HDDs as the stoarge medium. (We already have these as part of our existing backup system.) These will be plugged into the Bacula server (which is running the director, database and storage daemons). I want to be able to use the HDDs one at a time - i.e. have one HDD out and the others locked in the safe.

What I'm not too sure on is how to configure Bacula to live with the scenario, as potentially each HDD could occupy the same device node and mount point.
From what I can see, it could get confused about the absence of certain
volumes, as there would be no apparent difference between the drives once they are mounted - apart from their contents, of course. I read in the manual section referring to multiple tape drives about creating a series of symlinks in a directory to point to a number of different volumes - would this be appropriate here? Would Bacula be able to cope with the absence of a drive and prompt for its connection? Or is there a better approach of managing this scenario?

I am running Bacula on Debian Sarge, using the stock Debian version of the software.

Thanks in advance,

Tony Whitmore
Hi Tony,

I had the same problem you have some 1,5 years ago. Here are the scripts I used to work around it (made to work on a Mandrake/Mandriva system):

We make full backups every time. If you want to work with incremental backups, you should make two pools. One for the full backups and one for the incrementals. You can write the incrementals of the previous week on the USB-disk of the full backup of the next week. Each disk will then contain two volume files. In our case each disk contains only one volume file which is what we recognize it by.


#!/bin/bash
#
# shell script to finalize USB backup

volumename=$1
echo "   Creating mount points, if they don't exist"
if ! [ -d /mnt/usbdrv ] ; then
 mkdir /mnt/usbdrv
fi
if ! [ -d /mnt/usbdrv/bacula ] ; then
 mkdir /mnt/usbdrv/bacula
fi
if ! [ -d /mnt/usbdrv/misc ] ; then
 mkdir /mnt/usbdrv/misc
fi
#unmount all mount points related to USB

echo "   Making sure no USB devices are mounted"
umount /mnt/usbdrv
umount /mnt/usbdrv/bacula
umount /mnt/usbdrv/misc
umount /mnt/removable
umount /mnt/removable2
umount /mnt/removable3

#determine which /dev/sd? contains the right USBVolume for this backup

echo " Determining whether the right USB device containing our USBVolume is present physically"

found=nothing
for i in sda sdb sdc sdd sde; do
 sd=$i"1"
 echo "   Trying with $sd"
 mount /dev/$sd /mnt/usbdrv/bacula -t ext2
 ls -al /mnt/usbdrv/bacula

 if [ -f /mnt/usbdrv/bacula/$volumename ] ; then
   found=/dev/$i
 fi
 umount /mnt/usbdrv/bacula
done

echo
echo "    Found: $found containing $volumename "
echo
if [ $found != nothing ] ; then
# mount /mnt/usbdrv/bacula and /mnt/usbdrv/misc on /dev/sd?1 and /dev/sd?5 respectively
 mount $found"1" /mnt/usbdrv/bacula -t ext2
 mount $found"5" /mnt/usbdrv/misc -t vfat

# copy Ghost images of Windows system drives, the contents of /etc/bacula/*
  # and a text file with restore instructions to /mnt/usbdrv/misc

 echo "   Copying Ghost image of TOSFEB31 to /mnt/usbdrv/misc"
 cp -v /mnt/Ghost/PROD/TOSFEB31/SYSTEM.GHO /mnt/usbdrv/misc
 echo "   Copying Ghost image of TOSFEB32 to /mnt/usbdrv/misc"
 cp -v /mnt/Ghost/PROD/TOSFEB32/COFTF32.GHO /mnt/usbdrv/misc
 echo "   Copying /etc/bacula to /mnt/usbdrv/misc"
 cp -Rfv /etc/bacula/ /mnt/usbdrv/misc
 echo "   Copying Restore instructions to /mnt/usbdrv/misc"
 cp -v /etc/bacula/How_To_Restore.txt /mnt/usbdrv/misc

# copy the current USBVolume to /mnt/usbdrv/bacula overwriting the previous volume file
 echo
 echo "   Copying Bacula USB-volume to /mnt/usbdrv/bacula"

 cp -fv /mnt/spool/$volumename /mnt/usbdrv/bacula

  # give some feedback about what was done

 echo
 echo "   Directory contents of /mnt/usbdrv/bacula"
 ls -al /mnt/usbdrv/bacula
 echo
 echo "   Directory contents of /mnt/usbdrv/misc"
 ls -al /mnt/usbdrv/misc

  # unmount /mnt/usbdrv/bacula and /mnt/usbdrv/misc
 echo
 echo "   Directory contents of /mnt/usbdrv/misc"
 ls -al /mnt/usbdrv/misc

  # unmount /mnt/usbdrv/bacula and /mnt/usbdrv/misc
 echo
 echo "   Unmounting /mnt/usbdrv/... mount points"
 umount /mnt/usbdrv/bacula
 umount /mnt/usbdrv/misc

else
  # send emails if correct medium is not present
#  /usr/sbin/smtp
 echo "hello"
fi

# This is run as a RunAfterJob of the catalog backup. It already had a RunAfterJob, so we execute that here
/etc/bacula/delete_catalog_backup


This one I use as an admin job on Friday, before our weekly backup gets written:


#!/bin/bash
#
# shell script to check which USB volume is connected.

volumename=$1

echo "   Creating mount points, if they don't exist"
if ! [ -d /mnt/usbdrv ] ; then
 mkdir /mnt/usbdrv
fi
if ! [ -d /mnt/usbdrv/bacula ] ; then
 mkdir /mnt/usbdrv/bacula
fi
if ! [ -d /mnt/usbdrv/misc ] ; then
 mkdir /mnt/usbdrv/misc
fi
#unmount all mount points related to USB

echo "   Making sure no USB devices are mounted"
umount /mnt/usbdrv
umount /mnt/usbdrv/bacula
umount /mnt/usbdrv/misc
umount /mnt/removable
umount /mnt/removable2
umount /mnt/removable3

#determine which /dev/sd? contains the right USBVolume for this backup

echo " Determining whether the right USB device containing our USBVolume ($volumename) is present physically"

found=nothing
for i in sda sdb sdc sdd sde; do
 sd=$i"1"
 echo "   Trying with $sd"
 mount /dev/$sd /mnt/usbdrv/bacula -t ext2
 ls -al /mnt/usbdrv/bacula
 if [ -f /mnt/usbdrv/bacula/$volumename ] ; then
   found=/dev/$i
   foundvol=$volumename
 else
   for vn in USBVolume0001 USBVolume0002 USBVolume0003; do
     if [ -f /mnt/usbdrv/bacula/$vn ] ; then
       found=/dev/$i
       foundvol=$vn
     fi
   done
 fi

 umount /mnt/usbdrv/bacula
done

echo
echo "    Found: $found containing $foundvol "
echo

if [ $foundvol=$volumename ] ; then
 exit 0
fi
if [ $found != nothing ] ; then
 exit 0
else
echo No external USB drive is connected! Please find out which drive is needed and connect it.
 echo This probably should be $volumename
 echo
 echo
 exit -1
fi





-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to