On 04/06/10 05:51, Kevin Keane wrote:
> There are still a few things that don't work well with bacula.
> Concurrency is one - it should really be possible to open more than
> one file-based volume at the same time. Automatically deleting
> file-based volumes from disk is another (I think the new 5.x version
> addresses that).

It is possible right now to open more than one file-based volume at a
time.  You simply need to define multiple storage devices under the same
storage daemon; each device can have one volume open at a time.
However, if multiple volumes are being written at a time, this merely
exchanges volume interleaving for disk fragmentation.  The odds are good
the data will actually end up in the same places on disk; it will just
appear, from the point of view of scanning volumes, to be unfragmented,
because the disk system hides the fragmentation from you - exactly as it
is supposed to.  As previously mentioned, this can be overcome
essentially only by using a complete custom filesystem and disk driver
that treats disks like tapes.

Bacula-5 does not automatically delete expired disk volumes; it does
contain a feature to automatically truncate them to zero bytes.  Note
that this feature is dangerously broken in 5.0.0 (in which it was a new
feature), and should not be used in that version; if you want to use the
volume truncation feature, you must run 5.0.1 or later.

Automatic volume deletion can be handled fairly simply using an admin
job that runs a script to delete expired volumes; I've attached mine as
an example.


-- 
  Phil Stracchino, CDK#2     DoD#299792458     ICBM: 43.5607, -71.355
  ala...@caerllewys.net   ala...@metrocast.net   p...@co.ordinate.org
         Renaissance Man, Unix ronin, Perl hacker, Free Stater
                 It's not the years, it's the mileage.
#!/usr/bin/perl
use strict;
use Getopt::Long;
use IPC::Open2;
use IO::Handle;


my $bconsole = '/opt/bacula/bin/bconsole';
my (%opts, @purged, $pid);

GetOptions(\%opts,
           'verbose|v',
           'test');

my ($IN, $OUT) = (IO::Handle->new(), IO::Handle->new());

$pid = open2($OUT, $IN, $bconsole);

if (scalar (@purged = check_volumes()))
{
    printf("Bacula reports the following purged volumes:\n\t%s\n",
           join("\n\t", @purged)) if ($opts{verbose});
    my $deleted = delete_volumes(@purged);
    print "$deleted volumes deleted.\n" if ($opts{verbose});
}
elsif ($opts{verbose})
{
    print "No purged volumes found to delete.\n";
}

print $IN "exit\n";
waitpid($pid, 0);

exit (0);


sub check_volumes
{
    my $dividers = 0;
    my (@purged, @row);

    print $IN "list volumes pool=Scratch\n";
    for (;;)
    {
        my $resp = <$OUT>;
        last if ($resp =~ /No results to list./);
        $dividers++ if ($resp =~ /^[\+\-]+$/);
        last if ($dividers == 3);
        @row = split(/\s+/, $resp);
        push (@purged, $row[3]) if ($row[5] eq 'Purged');
    }

    return (@purged);
}


sub delete_volumes
{
    my $volume_dir = '/spool/bacula/';
    my $count = 0;

    foreach my $vol (@_)
    {
        my $l;
        my $file = $volume_dir.$vol;

        print "Deleting volume $vol from catalog ... " if ($opts{verbose});
        print $IN "delete volume=$vol yes\n";
        $l = <$OUT>;
        $l = <$OUT>;
        print "Done.\nDeleting volume $file from disk ... " if ($opts{verbose});
        if (-f $file)
        {
            $count++;
            unlink ($file);
        }
        print "Done.\n" if ($opts{verbose});
    }

    return ($count);
}
------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to