I have worked around my problem with raw LVM2 partition backups.

FYI, I am doing this to backup my BackupPC pool, which resides entirely
on a LVM2 partition.  This is
substantially faster then trying to do a file backup of the BackupPC
pool, due to the hard link handling
in bacula.  The space requirement on tape does not change much as the
BackupPC pool is already
compressed.

I found that I had to use a FIFO to perform the raw backup.  For
whatever reasonm I just could not get bacula
to write the raw partition using File = /dev/vg/partition in my fileset
directive.
Since I could not find any documentation for setting up a fifo from a
runBeforeJob script, I began experimenting...
What I found was that I could not just write a script that would create
a FIFO and then background a 'dd' command, bacula would hang on the 'dd'
process.
My solution was to write a little (very basic) perl server (this script,
of course, will be further developed):

#! /usr/bin/perl

  my $fifo = '/tmp/cmdfifo';

  while (1) {
    my $cmd = '';
    open(FIFO, $fifo);

    while (<FIFO>) {
      $cmd = $_;
    }
    close FIFO;

    print "fifo commander: received command '$cmd'\n";
    if ($cmd =~ /^BACKUP/) {
      print "fifo commander: executing backup setup script...\n";
      system('/etc/bacula/backuppc_create_snapshot');
    }
  }

exit;
(end script)

(The fifo's in the /tmp directory were created before execution)

In my bacula-dir.conf job definition I just use the line:

RunBeforeJob  = "sh -c 'echo BACKUP >>/tmp/cmdfifo'"

Which sends a command to my script, which runs the script in /etc/bacula
to create a snapshot, and start
'dd':
#! /bin/sh
#
# backuppc_create_snapshot
#
# Bash script to unmount old snapshot, then create new one.  Designed to
be called by bacula
# before backups written.
#

#umount /mnt/snapshot/backuppc
lvremove -f /dev/vg/snap_backuppc
lvcreate -s -n snap_backuppc -L50G /dev/vg/backuppc2

#mount /dev/vg/snap_backuppc /mnt/snapshot/backuppc
setsid dd if=/dev/vg/snap_backuppc of=/tmp/testfifo bs=16384

(end script)

This system worked.  I was able to back up my BackupPC pool in about
4hrs as opposed to 20+ it took before.
Maybe this is not the best way of doing things, but it works and seems
to perform well.  I am thinking of enchancing my perl server to take
more complex command to set up any snapshot/partition...

Jeff



-------------------------------------------------------
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