* USE IT AT YOUR OWN RISK * |
USE IT AT YOUR OWN RISK |
-- |
<code> |
</code> |
-- |
And to restore a snapshot... do:
<code> #!/bin/bash # [by MarkS? AKA Skram; mark@SentienSystems?.com # Restores VServer snapshots which were made with brc_ (Bruce)'s vserver_snapshot_create.sh AKA vserver-snapmake ## Run: vserver-snaprestore vserver_name ## Purpose: Restore a snapshot of a VServer ## * PLEASE USE THIS AT YOUR OWN RISK * ## Configuration files: # Where are snapshots going to be mounted? SNAPSHOT_MOUNT_DIR=/tmp/snapshots_mounted # Where are snapshots going to be stored? SNAPSHOT_DIR=/nas/1/vserver-snapshots # Vserver VSERVER_DIR=/vservers/ # Checking arguments if [ $# -ne 1 ]; then echo 1>&2 Usage: $0 vserver_name exit 0 fi VSERVER=$1 SNAPSHOT_FILE=$SNAPSHOT_DIR/$1.img # Checking if directories exist if [ ! -d $SNAPSHOT_MOUNT_DIR ] then echo "SNAPSHOT_MOUNT_DIR $SNAPSHOT_MOUNT_DIR does not exist" exit 1 fi if [ ! -d $SNAPSHOT_DIR ] then echo "SNAPSHOT_DIR $SNAPSHOT_DIR does not exist" exit 1 fi # Checking if snapshot file already exists if [ ! -e $SNAPSHOT_FILE ] # if it doesnt.. make it! then echo "$SNAPSHOT_DIR/$VSERVER.img doesn't exist; use 'vserver-snapmake $VSERVER SIZE_IN_MB' to create it" fi # Restoring Snapshot... mkdir $SNAPSHOT_MOUNT_DIR/$VSERVER mount $SNAPSHOT_DIR/$1.img $SNAPSHOT_MOUNT_DIR/$VSERVER -o loop rsync $SNAPSHOT_MOUNT_DIR $VSERVER_DIR/$VSERVER umount $SNAPSHOT_MOUNT_DIR/$VSERVER echo "If there were not any errors, your snapshot is probrably restored at $VSERVER/$1/" </code> |