Receive initial snapshots on target

This commit is contained in:
Les De Ridder 2016-05-05 00:52:02 +00:00
parent f30b56ed80
commit 49a6c0e0ae
3 changed files with 18 additions and 0 deletions

View File

@ -22,7 +22,16 @@ for pair in (get-subvol-mounts)
set safepath $subvoldir/$safename
sudo btrfs subvolume snapshot -r $mount $safepath
set snapshots $snapshots $safepath
end
echo "Syncing..."
sync
echo "Sending to target..."
for snapshot in $snapshots
sudo btrfs send $snapshot | receive-on-target
end
echo "Done!"

View File

@ -1,3 +1,8 @@
#!/usr/bin/fish
set subvoldir "/var/backups/subvols"
set targethost "elsa"
set targetuser "oakenbackups"
set targetpath "/home/lesderid/Backups/oaken.lesderid.net"
set sshkey "/var/backups/.ssh/id_rsa"

View File

@ -5,6 +5,10 @@ function get-subvol-mounts
cat /etc/fstab | grep btrfs | cut -d\t -f2,4 | sed 's/\(.*\)\t.*,subvol=\(.*\)$/\2 \1/'
end
function receive-on-target
ssh -i $sshkey $targetuser@$targethost sudo btrfs receive $targetpath
end
function get-subvol
echo $argv | cut -d' ' -f1
end