1
0
Fork 0

Dirty migration of backup magic to external drive

This commit is contained in:
clerie 2022-01-24 19:20:09 +01:00
parent fca4f238ec
commit 8127ad8e02
1 changed files with 10 additions and 1 deletions

View File

@ -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" ''