We currently migrate to MediaWiki from our old installation, but not all content has been migrated yet. Take a look at the Wiki Team page for instructions how to help or browse through our new wiki at wiki.linux-vserver.org to find the information already migrated.

We have been talking on IRC about creating snapshots and letting users download it. I've created a small script that creates and sync snapshots. It is not well tested. Let me know if it worked for you or if you have ideas.

  • USE IT AT YOUR OWN RISK ***
#!/bin/bash
# Creates vserver snapshots with rsync - 02/08/2006 - abruce at @ at virtuaserver.com.br
# http://www.virtuaserver.com.br
#
# Run:
# vserver_snapshot_create.sh vserver_name
#
# Purpose: Create a snapshot from a vserver and allow its owner to download it.
# *** USE IT AT YOUR OWN RISK ***
#
# Todo: Restore snapshot
# Todo: Resize snapshot
#
# Configuration
#
# Where are snapshots going to be mounted?
SNAPSHOT_MOUNT_DIR=/tmp/
# Where are snapshots going to be stored?
SNAPSHOT_DIR=/tmp/snapshots
# Vserver
VSERVER_DIR=/vservers/

# Checking arguments
if [ $# -ne 2 ]; then
	echo 1>&2 Usage: $0 vserver_name size_in_megabytes
	exit 0
fi

VSERVER=$1
VSERVER_SIZE=$2

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 ]
then
	echo "Creating image file $SNAPSHOT_FILE with $VSERVER_SIZE megabytes."
	dd if=/dev/zero of=$SNAPSHOT_FILE bs=1048576 count=$VSERVER_SIZE
	echo "Formating Image"
	mkfs.ext2 $SNAPSHOT_FILE
fi

# Creating directory to mount this snapshot
mkdir $SNAPSHOT_MOUNT_DIR/$1

# Mounting snapshot (old one or the image we just created
echo "Mounting $SNAPSHOT_FILE at $SNAPSHOT_MOUNT_DIR/$1"
mount -t ext2 $SNAPSHOT_FILE $SNAPSHOT_MOUNT_DIR/$1 -o loop
# Syncing snapshot with vserver (better to do when vserver not running)
echo "Rsyncing ..."
rsync -avz --delete $VSERVER_DIR/$1/ $SNAPSHOT_MOUNT_DIR/$1
# Umounting snapshot image
echo "Umounting snapshot image"
umount $SNAPSHOT_MOUNT_DIR/$1

# Removing directory that was created to mount this snapshot
rmdir $SNAPSHOT_MOUNT_DIR/$1

echo "If there were not any errors, your snapshot is probrably ready at $SNAPSHOT_FILE"