Add docker image for ceph-rbd backups

This commit is contained in:
Lol3rrr
2026-10-02 23:34:52 +02:00
parent d61cc8627b
commit 0105c98ce5
3 changed files with 36 additions and 0 deletions

21
ceph-rbd-backup/script.sh Normal file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -euo pipefail
CEPH_USERNAME="${CEPH_USERNAME:-}"
RBD_POOL="${RBD_POOL:-}"
RBD_IMAGE_ID="${RBD_IMAGE_ID:-}"
SNAPSHOT_ID="${SNAPSHOT_ID:-}"
OUTPUT_FILE="${OUTPUT_FILE:-}"
# Create the snapshot
rbd --name ${CEPH_USERNAME} snap create ${RBD_POOL}/${RBD_IMAGE_ID}@${SNAPSHOT_ID};
# Export the snapshot to a file
rbd --name ${CEPH_USERNAME} export --export-format 2 ${RBD_POOL}/${RBD_IMAGE_ID}@${SNAPSHOT_ID} - | zstd -T1 -3 ${OUTPUT_FILE};
touch ${OUTPUT_FILE}.done;
ls -al ${OUTPUT_FILE};
# Remove the snapshot again
rbd --name ${CEPH_USERNAME} snap rm ${RBD_POOL}/${RBD_IMAGE_ID}@${SNAPSHOT_ID};