Only include bootstrapped subvolumes in backups

This commit is contained in:
Les De Ridder 2016-05-23 22:13:24 +00:00
parent f9b3f450bb
commit b7f577bda3
1 changed files with 10 additions and 4 deletions

View File

@ -18,9 +18,13 @@ for pair in (get-subvol-mounts)
set safename (clean-name $subvol)
set safepath $subvoldir/$safename
sudo btrfs subvolume snapshot -r $mount $safepath-new
if test -d $safepath
sudo btrfs subvolume snapshot -r $mount $safepath-new
set snapshots $snapshots $safepath
set snapshots $snapshots $safepath
else
echo $mount "is not bootstrapped and will not be included in the backups!"
end
end
echo "Syncing..."
@ -41,8 +45,10 @@ echo "Renaming subvolumes on target..."
for pair in (get-subvol-mounts)
set subvol (clean-name (get-subvol $pair))
rename-target-subvolume $subvol $subvol.(date +%Y-%m-%d)
rename-target-subvolume $subvol-new $subvol
if test -d $subvoldir/$subvol
rename-target-subvolume $subvol $subvol.(date +%Y-%m-%d)
rename-target-subvolume $subvol-new $subvol
end
end
echo "Done!"