Add docker image for ceph-rbd backups
This commit is contained in:
21
ceph-rbd-backup/script.sh
Normal file
21
ceph-rbd-backup/script.sh
Normal 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};
|
||||
Reference in New Issue
Block a user