Only include bootstrapped subvolumes in backups
This commit is contained in:
parent
f9b3f450bb
commit
b7f577bda3
14
backup.fish
14
backup.fish
|
@ -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!"
|
||||
|
|
Loading…
Reference in New Issue