dsnap-sync: btrfs send/recieve pipe update
* always use btrfs with '-p flag' for sending incremental streams Andrei: https://www.spinics.net/lists/linux-btrfs/msg69369.html Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
This commit is contained in:
@@ -1220,14 +1220,15 @@ run_backup () {
|
|||||||
cmd="$ssh stat --format %i $backup_root/$snapper_snapshots/$snapper_source_sync_id 2>/dev/null"
|
cmd="$ssh stat --format %i $backup_root/$snapper_snapshots/$snapper_source_sync_id 2>/dev/null"
|
||||||
ret=$(eval $cmd)
|
ret=$(eval $cmd)
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
# Sends the difference between the new snapshot and old synced snapshot to the
|
# Sends the difference between the new snapshot and old synced snapshot.
|
||||||
# backup location. Using the -c (clone-source) flag instead of -p (parent) tells it
|
# Using the flag -p (parent) will require the availibility of an identical readonly
|
||||||
# that there is an identical subvolume to the synced snapshot at the receiving
|
# subvolume on the source and the receiving location (the parent-id).
|
||||||
# location where it can get its data. This helps speed up the transfer.
|
# using "btrfs send -p" instead of "btrfs send -c", then no parent search would be
|
||||||
cmd="btrfs send $verbose_flag -c $snapper_source_sync_snapshot $snapper_source_snapshot 2>$BTRFS_PIPE \
|
# needed (Andreij explained in: https://www.spinics.net/lists/linux-btrfs/msg69369.html)
|
||||||
|
cmd="btrfs send $verbose_flag -p $snapper_source_sync_snapshot $snapper_source_snapshot 2>$BTRFS_PIPE \
|
||||||
| $cmd_pv $ssh btrfs receive $verbose_flag $snapper_target_snapshot 2>$BTRFS_PIPE"
|
| $cmd_pv $ssh btrfs receive $verbose_flag $snapper_target_snapshot 2>$BTRFS_PIPE"
|
||||||
if [ $verbose -ge 3 ]; then
|
if [ $verbose -ge 3 ]; then
|
||||||
printf "${GREEN}btrfs send${NO_COLOR} is using snapshot ${GREEN}'%s'${NO_COLOR} from ${GREEN}target${NO_COLOR} to sync metadata for new snapshot ${GREEN}'%s'${NO_COLOR} ...\n" \
|
printf "${GREEN}btrfs send${NO_COLOR} is using snapshot ${GREEN}'%s'${NO_COLOR} from ${GREEN}source${NO_COLOR} to sync metadata for new snapshot ${GREEN}'%s'${NO_COLOR} ...\n" \
|
||||||
"$snapper_source_sync_snapshot" "$snapper_source_snapshot"
|
"$snapper_source_sync_snapshot" "$snapper_source_snapshot"
|
||||||
printf "${GREEN}btrfs command:${NO_COLOR} '%s'\n" "$cmd"
|
printf "${GREEN}btrfs command:${NO_COLOR} '%s'\n" "$cmd"
|
||||||
fi
|
fi
|
||||||
@@ -1237,18 +1238,11 @@ run_backup () {
|
|||||||
die "btrfs pipe error."
|
die "btrfs pipe error."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# need to use source snapshot to provide metadata for target
|
# is this clause possible?
|
||||||
cmd="btrfs send $verbose_flag -p $snapper_source_sync_snapshot $snapper_source_snapshot 2>$BTRFS_PIPE \
|
|
||||||
| $cmd_pv $ssh btrfs receive $verbose_flag $snapper_target_snapshot 2>BTRFS_PIPE"
|
|
||||||
if [ $verbose -ge 3 ]; then
|
if [ $verbose -ge 3 ]; then
|
||||||
printf "${GREEN}btrfs send${NO_COLOR} is using snapshot ${GREEN}'%s'${NO_COLOR} from ${GREEN}source${NO_COLOR} to sync metadata ...\n" \
|
printf "${RED}Error: ${NO_COLOR}No commen sync snapshot ${GREEN}'%s'${NO_COLOR} on ${GREEN}source${NO_COLOR} to sync metadata ...\n" \
|
||||||
"$snapper_source_sync_snapshot"
|
"$snapper_source_sync_snapshot"
|
||||||
printf "${GREEN}btrfs command:${NO_COLOR} '%s'\n" "$cmd"
|
die "btrfs send/recieve error."
|
||||||
fi
|
|
||||||
eval $cmd 1>/dev/null
|
|
||||||
if [ "$?" -gt 0 ]; then
|
|
||||||
printf "${RED}BTRFS_PIPE: %s${NO_COLOR}\n" "$(eval cat $BTRFS_PIPE)"
|
|
||||||
die "btrfs pipe error."
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user