Receive initial snapshots on target
This commit is contained in:
parent
f30b56ed80
commit
49a6c0e0ae
|
@ -22,7 +22,16 @@ for pair in (get-subvol-mounts)
|
||||||
set safepath $subvoldir/$safename
|
set safepath $subvoldir/$safename
|
||||||
|
|
||||||
sudo btrfs subvolume snapshot -r $mount $safepath
|
sudo btrfs subvolume snapshot -r $mount $safepath
|
||||||
|
|
||||||
|
set snapshots $snapshots $safepath
|
||||||
end
|
end
|
||||||
|
|
||||||
echo "Syncing..."
|
echo "Syncing..."
|
||||||
sync
|
sync
|
||||||
|
|
||||||
|
echo "Sending to target..."
|
||||||
|
for snapshot in $snapshots
|
||||||
|
sudo btrfs send $snapshot | receive-on-target
|
||||||
|
end
|
||||||
|
|
||||||
|
echo "Done!"
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
#!/usr/bin/fish
|
#!/usr/bin/fish
|
||||||
|
|
||||||
set subvoldir "/var/backups/subvols"
|
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"
|
||||||
|
|
|
@ -5,6 +5,10 @@ function get-subvol-mounts
|
||||||
cat /etc/fstab | grep btrfs | cut -d\t -f2,4 | sed 's/\(.*\)\t.*,subvol=\(.*\)$/\2 \1/'
|
cat /etc/fstab | grep btrfs | cut -d\t -f2,4 | sed 's/\(.*\)\t.*,subvol=\(.*\)$/\2 \1/'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function receive-on-target
|
||||||
|
ssh -i $sshkey $targetuser@$targethost sudo btrfs receive $targetpath
|
||||||
|
end
|
||||||
|
|
||||||
function get-subvol
|
function get-subvol
|
||||||
echo $argv | cut -d' ' -f1
|
echo $argv | cut -d' ' -f1
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue