[Gluster-users] glusterfs backup - how to migrate image to new server?

Merlin Morgenstern merlin.morgenstern at gmail.com
Wed Nov 18 12:39:49 UTC 2015


I am running glusterfs on a 3 node prod server with thinly provisioned
LVM-Volumes. My goal is to automate a backup process that is based on
gluster snapshots. The idea is basically to run a shell script via cron
that takes the snapshot, zips it and moves it to a remote server.

Backup works, now I do want to test restoring it on a development server
with a similar glusterfs setup. My question is, how to restore this image
into gluter. Is this simply by replacing the brick, or would I run into
conflicts with the volume_id or similar things?

This is how my script looks like so far:

#!/bin/bash

NOW=$(date +%Y%m%d_%H%M%S)
DAY=$(date +%u)

GS_VOLUME="vol1"
BACKUP_DIR="/home/user/backup/"
SNAP_NAME="snap_"$GS_VOLUME"-"$NOW

# create snapshot
gluster snapshot create $SNAP_NAME $GS_VOLUME no-timestamp

# get snapshot volume name
SNAP_VOL_NAME=$(gluster snapshot info $SNAP_NAME | grep "Snap\ Volume\
Name" | sed -e 's/.*S.*:.//g')
MOUNT_OBJECT="/dev/vg0/"$SNAP_VOL_NAME"_0"
MOUNT_POINT="/run/gluster/snaps/$SNAP_VOL_NAME/brick1"

# umount the image
umount $MOUNT_POINT

# create backup
sudo dd if=$MOUNT_OBJECT | lz4c -c > $BACKUP_DIR$SNAP_NAME.ddimg.lz4

# mount image back
mount $MOUNT_OBJECT $MOUNT_POINT

Thank you in advance for any help on this toppic.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gluster.org/pipermail/gluster-users/attachments/20151118/60c27537/attachment.html>


More information about the Gluster-users mailing list