Skip to content

Instantly share code, notes, and snippets.

@debuglevel
Created November 21, 2023 16:24
Show Gist options
  • Save debuglevel/46dca9510db014772c584772ee69eae7 to your computer and use it in GitHub Desktop.
Save debuglevel/46dca9510db014772c584772ee69eae7 to your computer and use it in GitHub Desktop.
borg index bloater to reproduce a error with borg in some environment
#!/bin/bash
# - Ensure your SSH key is loaded in ssh-agent.
# - Ensure borg repository exists (use `-e none` to disable encyption).
repository="ssh://[email protected]:23/./BorgBackup/repodir"
export BORG_PASSPHRASE="dsadsdadsadsadsadsasda"
i=0
while true; do
((i++))
echo "Starting iteration #$i."
backupname=dummy-$(date -I'seconds')
# NOTE: You'd usually use /dev/urandom as a random source; but it's quite slow.
# The openssl command provides about 2GB/s whereas /dev/urandom only about 25MB/s.
# dd if=/dev/urandom bs=1M count=50000 | borg create -v --progress --files-cache=disabled --stdin-name=dummy $repository::$backupname -
# CAUTION: Do not change bs=4k because of reasons.
#openssl rand -hex 32 | openssl enc -aes-128-ctr -in /dev/zero -pass stdin -nosalt | dd if=/dev/stdin of=/dev/stdout bs=4k count=1M | borg create --chunker-params='9,16,12,4095' --progress --verbose --debug --remote-path=borg-1.2 --stats --files-cache=disabled --stdin-name=dummy $repository::$backupname -
#openssl rand -hex 32 | openssl enc -aes-128-ctr -in /dev/zero -pass stdin -nosalt | dd if=/dev/stdin of=/dev/stdout bs=4k count=100000 | borg create --chunker-params='6,13,6,4095' --progress --verbose --debug --remote-path=borg-1.2 --stats --files-cache=disabled --stdin-name=dummy $repository::$backupname -
openssl rand -hex 32 | openssl enc -aes-128-ctr -in /dev/zero -pass stdin -nosalt | dd if=/dev/stdin of=/dev/stdout bs=4k count=20000 | borg create --chunker-params='fixed,128' --progress --verbose --debug --remote-path=borg-1.2 --stats --files-cache=disabled --compression none --stdin-name=dummy $repository::$backupname -
echo "Ended iteration #$i."
echo
sleep 3
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment