Browse Source

Dirty migration of backup magic to external drive

master
clerie 4 months ago
parent
commit
8127ad8e02
  1. 11
      hosts/palladium/backup-scripts.nix

11
hosts/palladium/backup-scripts.nix

@ -13,14 +13,23 @@ let @@ -13,14 +13,23 @@ let
cb-sync = pkgs.writeScriptBin "cb-sync" ''
#!${pkgs.bash}/bin/bash
set -e
# Check, if the something is mounted in our sycdir
if grep -qs '/mnt/external-drive' /proc/mounts
then
rsync -rltD '/mnt/palladium/alpha.0/clerie-backup/clerie-backup-replication/' '/mnt/external-drive/clerie-backup'
echo "fine"
else
echo "Please plug in a backup drive and mount it using cb-mount"
exit 1
fi
SNAPSHOT_NAME=$(${pkgs.borgbackup}/bin/borg list --last 1 --short /mnt/palladium/clerie-backup)
${pkgs.borgbackup}/bin/borg mount /mnt/palladium/clerie-backup::$SNAPSHOT_NAME /mnt/clerie-backup-mount
${pkgs.bindfs}/bin/bindfs /mnt/clerie-backup-mount/mnt/clerie-backup /mnt/clerie-backup
${pkgs.borgbackup}/bin/borg create /mnt/external-drive/clerie-backup::$SNAPSHOT_NAME /mnt/clerie-backup
umount /mnt/clerie-backup-mount
${pkgs.borgbackup}/bin/borg unmoumt /mnt/clerie-backup-mount
'';
cb-unmount = pkgs.writeScriptBin "cb-unmount" ''

Loading…
Cancel
Save