[add] borg_partclone_backup.sh
This commit is contained in:
parent
7244206de5
commit
253a764d8e
22
borg_partclone_backup.sh
Executable file
22
borg_partclone_backup.sh
Executable file
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/bash
|
||||
# Usage: borg_partclone_backup.sh VGNAME LVNAME SNP_SZ SRV_HOST SRV_BORG_REPO
|
||||
VGNAME=`shift`
|
||||
LVNAME=`shift`
|
||||
SNP_NM=$LVNAME-`date +%Y%m%dT%H%M%S`
|
||||
SNP_SZ=`shift`
|
||||
SRV_HOST=`shift`
|
||||
SRV_BORG_REPO=`shift`
|
||||
|
||||
# Be root
|
||||
test `id -u` == "0" || exit 1
|
||||
|
||||
# Create the snapshot
|
||||
lvcreate -y -n $SNP_NM -s -L $SNP_SZ $VGNAME/$LVNAME
|
||||
|
||||
# Clone
|
||||
partclone.ext4 -s /dev/$VGNAME/$SNP_NM -c | \
|
||||
BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=yes \
|
||||
borg2 -r ssh://$SRV_HOST$SRV_BORG_REPO create -s $SNP_NM -
|
||||
|
||||
# Remove the snapshot
|
||||
lvremove -y $VGNAME/$SNP_NM
|
Loading…
Reference in New Issue
Block a user