This commit is contained in:
Björn 2025-08-25 17:53:03 +02:00 committed by GitHub
commit 5325e0c263
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 2 deletions

11
sanoid
View File

@ -883,10 +883,17 @@ sub getsnaps {
print "INFO: cache expired - updating from zfs list.\n"; print "INFO: cache expired - updating from zfs list.\n";
} }
} }
open FH, "$zfs get -Hrpt snapshot creation |"; # just get snapshots from configured datasets to not spin up the disks
open FH, "$zfs get -Hrpt snapshot creation ".join(" ",keys %$config)." |";
@rawsnaps = <FH>; @rawsnaps = <FH>;
close FH; close FH;
$exit_code = $? >> 8;
if ($exit_code != 0) {
print "INFO: zfs list shapshots with dataset names does not work.. retrying without dataset names (this will spin-up all disks)\n";
open FH, "$zfs get -Hrpt snapshot creation |";
@rawsnaps = <FH>;
close FH;
}
open FH, "> $cache.tmp" or die "Could not write to $cache.tmp!\n"; open FH, "> $cache.tmp" or die "Could not write to $cache.tmp!\n";
print FH @rawsnaps; print FH @rawsnaps;
close FH; close FH;