[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-users] Quick image creation script (encapsulated documentation commands)



I dount anyone will find this useful as they've already
likely dealt with this by now, but just in case...

I am using it for Xen evaluation work.  It's nothing
other than the commands from the docs, encapsulated in
a script with an argument.

#!/bin/sh
#
# Where do you store your VM disk image files?
VMROOT=/vm-images
#
VMPREFIX="vm-"
#
VMSUFFIX="-disk"
#
# Size of disk images in KB
SIZE=4096
#
#-----------------------------------------------------------------------

VMID=$1

Usage () {
        echo "Usage: $0 <unique-identifer>"
        exit 1
}

if [ "$VMID"x = "x" ]; then
        Usage
fi

IMAGENAME="${VMROOT}/${VMPREFIX}${VMID}${VMSUFFIX}"
if [ -f $IMAGENAME ]; then
        echo "ERROR: $IMAGENAME already exists."
        exit 1
fi

echo "Creating $IMAGENAME ..."
echo "++ dd if=/dev/zero of=$IMAGENAME bs=1k seek=${SIZE}k count=1"
dd if=/dev/zero of=$IMAGENAME bs=1k seek=${SIZE}k count=1

echo "echo y | mkfs -t ext3 $IMAGENAME"
echo y | mkfs -t ext3 $IMAGENAME

echo "++ mount -o loop $IMAGENAME /mnt"
mount -o loop $IMAGENAME /mnt

echo "++ cp -ax /{root,dev,var,etc,usr,bin,sbin,lib} /mnt"
cp -ax /{root,dev,var,etc,usr,bin,sbin,lib} /mnt

echo "++ mkdir /mnt/{proc,sys,home,tmp}"
mkdir /mnt/{proc,sys,home,tmp}

echo "++ umount /mnt"
umount /mnt


_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.