Subject: Re: Xen and Raidframe
To: Geert Hendrickx <ghen@NetBSD.org>
From: Stephen Borrill <netbsd@precedence.co.uk>
List: port-xen
Date: 11/04/2006 17:42:48
On Sat, 4 Nov 2006, Geert Hendrickx wrote:
> On Sat, Nov 04, 2006 at 08:23:01AM -0500, Steven M. Bellovin wrote:
>> One apparent option, for the production DOMUs, is to have matching
>> partitions on each hard drive, and have the DOMUs do RAID themselves.  A
>> second is to use a large DOM0 partition, with RAID, and assign a DOMu a
>> file in that partition.  This strikes me as slower, but adequate for
>> light-load and experimental servers.
>
> The third (and I think most-used) option is to run the software RAID in the
> dom0 and provide each domU with a block device on the RAID (e.g. raid0g).
> The only challenge then (as well is with option two) is to teach GRUB, but
> this has been discussed on this list before.

I thought the consensus was that a block device vs a vnd wasn't much 
different in terms of speed (though this surprised me, I thought the 
former would be quicker).

However, I'm sticking with vnds as they are easier to move around between 
hosts. As per my email the other day asking about fss as a back strategy, 
I had a play and came up with a little script. It's hardwired for the domU 
having only a: (root) and b: (swap) partitions. It stores a vnd image on a 
remote server which is ready to bring up a domU from.

#!/bin/sh

host=`hostname`

url="ftp://fs:fs@192.168.1.1/"
output="${host%%.*}.fs"

root=`sysctl -n kern.root_device`
if [ -z "$root" ]; then
 	echo "Could not determine root device"
 	exit 1
fi
swapsz=`disklabel /dev/${root}d | awk '{if($1=="b:") print $2}'`
if [ -z "$swapsz" ]; then
 	echo "Could not determine swap device"
 	exit 1
fi
dev=`fssconfig -l | grep 'not in use$'`
dev="${dev%%:*}"
if [ -z "$dev" ]; then
 	echo "Could not find free snapshot device"
 	exit 1
fi
fssconfig $dev / /back || exit 1
rm -f /back
trap "fssconfig -u $dev; exit" 1 2 15
dd if=/dev/zero count=$swapsz | \
 	cat /dev/$dev - | \
 	gzip -c -2 | \
 	ftp -u "${url}${output}.tmp" -
ret=$?
fssconfig -u $dev 
if [ "$ret" = 0 -o $ret = 255 ]; then
 	printf "rename $output ${output}.bak\nrename ${output}.tmp ${output}\n" | ftp $url
fi

-- 
Stephen