diff --git a/sanoid b/sanoid index ce8207c..30363c5 100755 --- a/sanoid +++ b/sanoid @@ -502,7 +502,14 @@ sub take_snapshots { # update to most current possible datestamp %datestamp = get_date(); # print "we should have had a $type snapshot of $path $maxage seconds ago; most recent is $newestage seconds old.\n"; - push(@newsnaps, "$path\@autosnap_$datestamp{'sortable'}${dateSuffix}_$type"); + + # use zfs recursion if specified in config + if ($config{$section}{'zfs_recursion'}) { + push(@newsnaps, "-r $path\@autosnap_$datestamp{'sortable'}_$type"); + + }else{ + push(@newsnaps, "$path\@autosnap_$datestamp{'sortable'}_$type"); + } } } } @@ -530,7 +537,7 @@ sub take_snapshots { } if ($args{'verbose'}) { print "taking snapshot $snap\n"; } if (!$args{'readonly'}) { - system($zfs, "snapshot", "$snap") == 0 + system("$zfs snapshot $snap") == 0 or warn "CRITICAL ERROR: $zfs snapshot $snap failed, $?"; } if ($config{$dataset}{'post_snapshot_script'} and !$args{'readonly'}) { @@ -846,7 +853,10 @@ sub init { my $recursive = $ini{$section}{'recursive'} && grep( /^$ini{$section}{'recursive'}$/, @istrue ); my $skipChildren = $ini{$section}{'skip_children'} && grep( /^$ini{$section}{'skip_children'}$/, @istrue ); my @datasets; - if ($recursive || $skipChildren) { + + if($ini{$section}{'recursive'} =~ /zfs/i) { + $config{$section}{'zfs_recursion'} = 1; + }elsif ($ini{$section}{'recursive'}) { @datasets = getchilddatasets($config{$section}{'path'}); DATASETS: foreach my $dataset(@datasets) { chomp $dataset;