sub parsefsys () {
my ($dopts,$dopt);
if ($tf =~ m#^(/\S*)\s+(\w+)([,=0-9a-z]*)$#) {
- # Line of form '/file/system dumptype[,options]'
+ # Line of form '[/device:]/file/system dumptype[,options]'
$atf= $1;
$tm= $2;
$dopts= $3;
$prefix= '<local>';
+ $pcstr= '';
stat $atf or die "stat $atf: $!";
-d _ or die "not a dir: $atf";
$rstr= '';
} elsif ($tf =~ m#^(/\S*)\s+(\w+)([,=0-9a-z]*)\s+(\w+)$#) {
- # Line of form '/file/system dumptype[,options] prefix'
+ # Line of form '[/device:]/file/system dumptype[,options] prefix'
# (used for remote backups)
$atf= $1;
$tm= $2;
$dopts= $3;
$prefix= $4;
+ $pcstr= "$prefix:";
defined($prefix{$prefix}) or die "prefix $prefix in $tf ?\n";
$rstr= $prefix{$prefix}.' ';
} else {
die "fsys $tf ?";
}
+
+ $dev = $atf =~ s,^(.*)\:,, ? $1 : '';
+
undef %dopt;
foreach $dopt (split /\,/,$dopts) {
if (grep { $dopt eq $_ } qw(gz)) {
}
}
- if ($dopt{'gz'} eq 'y') {
- $gz= '1';
- } elsif ($dopt{'gz'} =~ m/^\d$/) {
- $gz= $dopt{'gz'};
- } elsif (defined $dopt{'gz'}) {
- die "$tf bad gz";
- } else {
- $gz= 0;
+ my ($gzo);
+ foreach $gzo (qw(gz gzi)) {
+ if ($dopt{$gzo} eq 'y') {
+ $$gzo= '1';
+ } elsif ($dopt{$gzo} =~ m/^\d$/) {
+ $$gzo= $dopt{$gzo};
+ } elsif (defined $dopt{$gzo}) {
+ die "$tf bad $gzo";
+ } else {
+ $$gzo= '';
+ }
}
}
$tape= $next;
}
+proc checkdevspec ($$$) {
+ my ($atf,$devspec,$why);
+ push @{ $devspec{$atf}{$devspec} }, $why;
+}
+
for $fsg (sort keys %fsgdone) {
print "filesystem group $fsg: ".join(' ',@{$fsgdone{$fsg}}).":\n ";
@fsys= ();
readfsys($fsg);
for $tf (@fsys) {
parsefsys();
- $pstr= $prefix ne '<local>' ? "$prefix:$atf" : $atf;
+ $pstr= "$pcstr$atf";
&e("dumped twice ($backed{$pstr}, $fsg): $pstr")
if defined $backed{$pstr};
$backed{$pstr}= $fsg;
+ checkdevspec($pstr,"$pcstr$dev","filesystem group $fsg")
+ if length $dev;
print " $pstr";
}
print "\n";
readfsys('all');
for $tf (@fsys) {
parsefsys();
- $pstr= $prefix ne '<local>' ? "$prefix:$atf" : $atf;
+ $pstr= "$pcstr$atf";
$incrd{$pstr}= $fsg;
+ checkdevspec($pstr,"$pcstr$dev","incremental group") if length $dev;
print " $pstr";
}
print "\n";
$cmd= "$rstr $dfstr";
open X, "$cmd |" or die $!;
$_= <X>; m/^Filesystem/ or die "$cmd => $_ ?";
- $ppstr= length($pfx) ? $pfx : '<local>';
- $pstr= length($pfx) ? "$pfx:" : '';
- print "mount points: $ppstr:";
+ $prefix= length($pfx) ? $pfx : '<local>';
+ $pcstr= length($pfx) ? "$pfx:" : '';
+ print "mount points: $prefix:";
while (<X>) {
chomp;
next if m,^procfs\s,;
m,^/dev/(\S+)\s.*\s(/\S*)\s*$, or die "$_ ?";
($dev,$mp) = ($1,$2);
- $mounted{"$pstr$mp"}="$pstr$dev"; print " $1-$2";
- if (defined($backto= $backed{"$pstr$mp"})) {
+ checkdevspec("$pcstr$imp","$pcstr/dev/$dev","df");
+ $mounted{"$pcstr$mp"}="$pcstr$dev"; print " $1-$2";
+ if (defined($backto= $backed{"$pcstr$mp"})) {
if (m,^/dev/\S+\s+\d+\s+(\d+)\s,) {
$usedkb{$backto} += $1;
} else {
$usedkb{$backto} += 0;
- $unkkb{$backto} .= " + $pstr$mp";
+ $unkkb{$backto} .= " + $prefix:$mp";
}
}
}
print "filesystem group $fsg: $usedkb{$fsg} 1K-blocks$unkkb{$fsg}\n";
}
+foreach $dsk (keys $devspec) {
+ if (@{ $devspec{$dsk} } != 1) {
+ foreach $devspec @{ $devspec{$dsk} } {
+ &e("inconsistent devices for $dsk: $devspec");
+ }
+ }
+}
+
# We check that all mounted filesystems are dumped and all
# filesystems to be dumped are mounted. The expected-diffs
# config file allows us to make exceptions.
for $fs (sort keys %backed) { length($mounted{$fs}) || &e("dumped ($backed{$fs}), not a mount point: $fs"); }
for $fs (sort keys %incrd) { length($mounted{$fs}) || &e("increm'd ($incrd{$fs}), not a mount point: $fs"); }
-for $fs (sort keys %mounted) { length($backed{$fs}) || &e("mount point ($mounted{$fs}), not dumped: $fs"); }
+for $fs (sort keys %mounted) {
+ next if $backed{$fs}
+ length($backed{$fs}) || &e("mount point ($mounted{$fs}), not dumped: $fs"); }
for $fs (sort keys %mounted) { length($incrd{$fs}) || &e("mount point ($mounted{$fs}), not increm'd: $fs"); }
$emsg.= "configuration ok\n" unless $e;
incremental backups.
<options> is a comma-separated list of <option> or <option>=<value>.
-The only currently support option is gz[=<compressionlevel>], to
+The only currently support options are gz[i][=<compressionlevel>], to
indicate that the whole stream should be compressed with gzip. The
-compression level defaults to 1.
+compression level defaults to 1 if gz is specified by the level isn't.
+gzi appliies only to the incrementals; gz applies to both unless gzi
+is also specified. compression level 0 means not to run gzip at all
+and is the default if gz[i] is not mentioned.
expected-diffs is a config file to indicate which
filesystems should *not* be backed up. The scripts do a config