Skip to content

Instantly share code, notes, and snippets.

@xemle
xemle / borg-concat-segments.sh
Created February 5, 2021 21:42
Concat borg segments to larger segments and reset their numbers
#!/bin/bash
#
# Concat borg segments to larger segments and reset their numbers
#
# As usecase I concatenated my 5MB segments to 128MB segments
#
# Each borg semenent is a list of entry logs prefixed by "BORG_SEG" magic
# header. They can be concatenated by removing the magic header but the first
# original segment. The segments must preserve their original natural order.
#
@xemle
xemle / borg-migrate-segments.sh
Created July 23, 2017 11:21
Reorder borg (borgbackup) segments if core repository config segments_per_dir was changed
#!/bin/sh
if [ -z "$BORG_REPO" ]; then
echo "BORG_REPO not set. Export variable like:"
echo "export BORG_REPO=/mnt/borg"
exit 1
fi
BORG_REPO=$(readlink -f "$BORG_REPO")
if [ ! -e "$BORG_REPO/config" ]; then
echo "Invalid BORG_REPO dir: $BORG_REPO"