Report free space on all found backup volumes and the total
This commit is contained in:
parent
8aa0c9ca5e
commit
0d7a8e667b
|
@ -71,19 +71,21 @@ my @backup_dirs = map {
|
|||
my $avg_file_size = $bavail * ($blocks - $bfree) / ($files - $ffree);
|
||||
my $available_bytes_by_files = $avg_file_size * $favail;
|
||||
$available_bytes = $available_bytes_by_files if $available_bytes_by_files < $available_bytes;
|
||||
$ca->log(3, "found base $_ (est. $available_bytes bytes)");
|
||||
[ $_, $available_bytes ]
|
||||
} glob("/backup/*/active");
|
||||
my $sum_free = 0;
|
||||
$sum_free += $_->[1] for (@backup_dirs);
|
||||
$ca->log(3, "total free est. $sum_free bytes");
|
||||
my $rnd = rand() * $sum_free;
|
||||
my $count_free = 0;
|
||||
my $backup_dir;
|
||||
for(@backup_dirs) {
|
||||
$count_free += $_->[1];
|
||||
$ca->log(3, "considering base $_->[0] (est. $_->[1] bytes)\n");
|
||||
$ca->log(3, "considering base $_->[0] (est. $_->[1] bytes)");
|
||||
if ($count_free >= $rnd) {
|
||||
$backup_dir = $_->[0];
|
||||
$ca->log(3, "using base $_->[0]\n");
|
||||
$ca->log(3, "using base $_->[0]");
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue