Jeff Blaine
2005-Apr-20 20:38 UTC
[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@lists.xensource.com http://lists.xensource.com/xen-users
Fernando Maior
2005-Apr-20 21:48 UTC
Re: [Xen-users] Quick image creation script (encapsulated documentation commands)
Great, Jeff! 2005/4/20, Jeff Blaine <jblaine@mitre.org>:> 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@lists.xensource.com > http://lists.xensource.com/xen-users >-- Bye, Fernando Maior LPIC/1 31908 _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users