+ covert size options in configuration files to bytes
- automatically expire iso images which are burned BurnMultipleCopies times
-- warn about disk usage in BackupPC_burnArchiveCLI before creating new iso image
++ warn about disk usage in BackupPC_burnArchiveCLI before creating new iso image
+ burn two copies of three part increment as 1 2 3 1 2 3 and not 1 1 2 2 3 3
- script to recover host pool from increments only
use Term::Menus;
use File::Which;
use File::Path;
+use Filesys::Df;
use Data::Dumper;
$sth->execute();
+sub fmt_mb($) {
+ my $s = shift;
+ die "missing size" unless defined($s);
+ $s /= (1024*1024);
+ return sprintf("%.2f Mb", $s);
+}
+
sub fmt_archive($) {
my $row = shift || die;
$row->{'date'} =~ s/\.\d+$//;
$row->{'copies'} =~ s/^\s*0+\s*$/no/;
- $row->{'total_size'} /= (1024*1024);
my $copies = 'copies';
$copies = 'copy' if ($row->{'copies'} == 1);
return
- sprintf("%d by %s on %s, %s %s [%.2f Mb]",
+ sprintf("%d by %s on %s, %s %s [%s]",
$row->{'dvd_nr'},
$row->{'username'},
$row->{'date'},
$row->{'copies'}, $copies,
- $row->{'total_size'},
+ fmt_mb($row->{'total_size'}),
);
}
$v = {};
}
$v->{size} += $row->{part_size};
+ $v_size += $row->{part_size};
+
# this part
my $p = {
filename => BackupPC::SearchLib::getGzipName($row->{'host'}, $row->{'share'}, $row->{'num'}),
}
push @volumes, $v if ($v);
- #warn "# volumes: ",Dumper(\@volumes),"\n";
+ #warn "# volumes: ",Dumper(\@volumes)," total size: ", fmt_mb($v_size), "\n";
+
+ # check available disk space
+
+ my $df = df($iso_dir);
+ if ($df < $v_size) {
+ warn "ABORTED: not enough disk space to create ISO ! [need ", fmt_mb($v_size), " have ", fmt_mb( df($iso_dir) ), "]\n";
+ next;
+ }
my $volumes = $#volumes + 1;
my $volume_nr = 1;
$disk_name .= ' ' . $volume_nr . '/' . $volumes;
}
- print "Processing DVD #$dvd_nr, volume $volume_nr/$volumes\n";
+ print "Processing DVD #$dvd_nr, volume $volume_nr/$volumes [", fmt_mb($v->{size}), "]\n";
my $iso_file = my $xml_file = my $stage =
"${iso_dir}/${dvd_nr}";