Koozali.org: home of the SME Server

Replacing flexbackup with bacula

Offline pearless

  • *
  • 38
  • +0/-0
Replacing flexbackup with bacula
« on: June 07, 2010, 06:59:45 AM »
Hi,

I have been using SME Server for a few years now, and I am fed up with the build in tape backup software (flexbackup) as it is very difficult to use when you need to span tapes (it won't) , or you just want to recover a single file (or less than a whole tape!!).

I started trying the smeserver-bacula contrib per http://forums.contribs.org/index.php?topic=45392.0 but I gave up.

I have bacula installed on SME Beta 8, and I have it backing up all the same files as the flexbackup backup software & restores these as well.

I am trying to work out the best way to integrate it; in the first instance I want to be able to run the pre-backup, post-backup, pre-restore and pre-/post- restore scripts, however, I do not want the tape relates ones (rewind or eject, etc) pre-/post- scripts to run as Bacula handles that for me. 

I have been reading through the SMEServer documentation and I am unclear how to do this.

For example, how can I get just the "/etc/e-smith/events/pre-backup/S10mysql-delete-dumped-tables " and the "/etc/e-smith/events/pre-backup/S20mysql-dump-tables" scripts to run, but not the "/etc/e-smith/events/pre-backup/S50rewind-tape".

Note: I have figured out how to call these from bacula and I could hard-code these, but I want to future proof these so that changes to these scripts are picked up by (future) bacula contrib.

Later I hope to be able to create a bootable USB or CD image that installs bacula plus my customisations, allows and then allows the admin to select which backup to restore (i.e. a full + incremental, etc).

Cheers
Douglas.

Offline Stefano

  • *
  • 10,836
  • +2/-0
Re: Replacing flexbackup with bacula
« Reply #1 on: June 07, 2010, 07:45:35 AM »
pearless.. you should open a NFR in bugzilla and subscribe dev's ML..

forums are not the right place

HTH

Offline pearless

  • *
  • 38
  • +0/-0
Re: Replacing flexbackup with bacula
« Reply #2 on: June 07, 2010, 09:24:48 AM »
Good points.

NFR raised, and I am now subscribed to the developers list too.

Cheers
Douglas.

Offline magwm

  • *
  • 157
  • +0/-0
  • SmeLover
    • Gadis Tourist Service Italia SRL
Re: Replacing flexbackup with bacula
« Reply #3 on: June 07, 2010, 12:05:57 PM »
Still, I would love to follow the progress on this..

Will you put something in the wiki/forum when there is an option thats viable for the 'normal' sme followers?

ciaociao, M
MagWm

Offline Stefano

  • *
  • 10,836
  • +2/-0
Re: Replacing flexbackup with bacula
« Reply #4 on: June 07, 2010, 12:14:43 PM »
Good points.

NFR raised, and I am now subscribed to the developers list too.

Cheers
Douglas.

please report here the reference, thank you

Offline Stefano

  • *
  • 10,836
  • +2/-0
Re: Replacing flexbackup with bacula
« Reply #5 on: June 07, 2010, 12:15:12 PM »
Still, I would love to follow the progress on this..

Will you put something in the wiki/forum when there is an option thats viable for the 'normal' sme followers?

ciaociao, M

you can follow the progress in bugzilla :-)

Offline pearless

  • *
  • 38
  • +0/-0
Re: Replacing flexbackup with bacula
« Reply #6 on: June 17, 2010, 12:28:10 AM »
I have written a script that tries to analyse the tape drive / changer / library connected to the SME server as part of an auto-magical set-up of Bacula (i.e. working with the existing Bacula contrib).

It assumes that if there is a tape library / changer it is attached to /dev/sgX where X is a..z or numeric, and all SCSI tape drives are attached to that device.

Could people try the script on their setup and post the results and comments so I can get it working for as many scenarios as possible (It is my very first PERL script so please forgive the coding...).

Cheers
Douglas.

Please cut the code below, save as find_tape.pl

make sure that any lines are not wrapped and therefore break!

then "chmod a+x find_tape.pl"
then run the script, post the output and comments as to whether it got it correct and if not, what it should have done.


Code: [Select]
#!/usr/bin/env perl
#use strict;
$|++;

use File::Find;
use Cwd 'abs_path';

my @tape_changers = ();
my @tape_drives = ();

print "Analysing tape drives on this machine\n";

my $dir = "/dev/tape";

find(\&do_something_with_file, $dir);

# and now print the results out for debug

if ($#tape_changers >=0) {  #remember an array is -1 if it is empty and starts at the zeroth position
  print "number of tape changers or libraries found is ".($#tape_changers+1)." and are:\n";
  foreach $tape_changer (@tape_changers) {
    print $tape_changer."\n";
    }
  }
if ($#tape_drives >=0) {  #remember an array is -1 if it is empty and starts at the zeroth position
  print "number of tape drives found is ".($#tape_drives+1)." and are:\n";
  foreach $tape_drive (@tape_drives) {
    print $tape_drive."\n";
    }
  }

#end of mainline

sub do_something_with_file
{

  my $file = $_;

# scan the tape devices
  if (-l $file) { # file is a link
     my $realfile = abs_path($file);
     my $is_it_a_changer = index $realfile, "/sg"; # we assume that a changer is on the generic scsi interface

     if ($is_it_a_changer > 0) {
       # we have found a generic scsi device, try to use mtx to retrieve its details, if this fails then
       # it is not a changer
       my @results = `mtx -f ${realfile} inquiry`;

       my $vendor ="";
       my $product="";

       foreach $result (@results) {

           # lets figure out what type of tape changer or library it is
           # we assume that we should get its name in something like:
           # Vendor ID: 'COMPAQ  '
           # Product ID: 'MSL5000 Series  '
       
           if ((index $result, "Vendor ID")>=0) {
             my $left_delim = (index $result, "'")+1;
             my $right_delim = (index $result, "'", $left_delim) - $left_delim;
             $vendor = substr($result, $left_delim, $right_delim);
             $vendor =~ s/^\s+//; # remove leading spaces
             $vendor =~ s/\s+$//; # remove trailing spaces
           }

           if ((index $result, "Product ID")>=0) {
             my $left_delim = (index $result, "'")+1;
             my $right_delim = (index $result, "'", $left_delim) - $left_delim;
             $product = substr($result, $left_delim, $right_delim);
             $product =~ s/^\s+//; # remove leading spaces
             $product =~ s/\s+$//; # remove trailing spaces
           }
       }

        #build a unique tape changer name in case there are more than one by adding the dev path as a suffix
        my $tape_changer = $vendor."_".$product."_".$realfile;
        $tape_changer =~ s/ /_/; # change any spaces to underscores
        push (@tape_changers , $tape_changer);

     } else { # must just be a tape drive
         my @results = `mt -f ${realfile} status`;
         foreach $result (@results) {

           # lets figure out what type of tape drive it is
           # we assume that we should get its name in something like:
           # Tape block size 0 bytes. Density code 0x48 (Quantum SDLT220).
           if ((index $result, "Density code")>0) {

           my $left_delim = (index $result, "(")+1;
           my $right_delim = (index $result, ")") - $left_delim;

           $vendor = substr($result, $left_delim, $right_delim);

           $vendor =~ s/^\s+//; # remove leading spaces
           $vendor =~ s/\s+$//; # remove trailing spaces
           $vendor =~ s/ /_/;   # change spaces to underscores

           my $tape_drive = $vendor."_".$realfile;
           push (@tape_drives , $tape_drive);

           }
        }
     }
  }
}

Offline hedererjs

  • *
  • 33
  • +0/-0
    • http://www.asperience.fr
Re: Replacing flexbackup with bacula
« Reply #7 on: August 11, 2010, 08:37:43 PM »
I have written a script that tries to analyse the tape drive / changer / library connected to the SME server as part of an auto-magical set-up of Bacula (i.e. working with the existing Bacula contrib).


I don't well understand what you try to do with this script
If you have some greetings for our bacula contrib, it's time to do!
David will make some improvements soon. Shooting target is open! (like NASA says?)

Offline pearless

  • *
  • 38
  • +0/-0
Re: Replacing flexbackup with bacula
« Reply #8 on: August 12, 2010, 03:31:50 AM »
The purpose of the script is to determine what tape drives, tape changers are connected to the server, plus which tape drives are accessible as what devices in the tape driver (e.g. when their are two tape drives in a changer, how are the referenced in /dev

In short, it will configure bacula for the tape changers and drives attached to the server.

I have also started to create the english support (e.g. translating the messages, forms, etc).

I am then looking at updating the package so others can acquire the changes (etc)

Cheers
Douglas.