#!/bin/sh clear vmname=debian-stable vmpath=/mnt/d200Go/xen/domains root=$vmpath/$vmname/$vmname.img swap=$vmpath/$vmname/$vmname.swap.img arch=i386 version=wheezy if [ -d $vmpath/$vmname/$vmname ] ; then echo rm -rf $vmpath/$vmname/$vmname rm -rf $vmpath/$vmname/$vmname fi echo . echo mkdir -p $vmpath/$vmname/$vmname mkdir -p $vmpath/$vmname/$vmname # Disk / 4Go echo . echo dd if=/dev/zero of=$root bs=1M count=4000 dd if=/dev/zero of=$root bs=1M count=4000 # swap 512Mo echo . echo dd if=/dev/zero of=$swap bs=1M count=512 dd if=/dev/zero of=$swap bs=1M count=512 echo . echo mkfs.ext4 -F $root; mkswap $swap mkfs.ext4 -F $root; mkswap $swap echo . echo mkdir -p /tmp/xen/$vmname mkdir -p /tmp/xen/$vmname echo . echo mount -t ext4 -o loop $root /tmp/xen/$vmname mount -t ext4 -o loop $root /tmp/xen/$vmname echo . echo debootstrap --arch $arch $version /tmp/xen/$vmname $mirror debootstrap --arch $arch $version /tmp/xen/$vmname $mirror echo . echo xen-create-image --verbose --dir=$vmpath --size=2Gb --swap=128Mb --memory=128Mb --fs=ext4 --dhcp --pygrub --passwd --dist=$version --force --hostname=$vmname xen-create-image --verbose --dir=$vmpath --size=2Gb --swap=128Mb --memory=128Mb --fs=ext4 --dhcp --pygrub --passwd --dist=$version --force --hostname=$vmname # modifs xen-tools.conf (dhcp, lvm, etc...) # copy img to lvm dd if=/home/xen/domains/xen1.example.com/disk.img of=/dev/vg0/xen1_root dd if=/home/xen/domains/xen1.example.com/swap.img of=/dev/vg0/xen1_swap --> change .cfg ... and change... [...] disk = [ 'file:/home/xen/domains/xen1.example.com/swap.img,xvda1,w', 'file:/home/xen/domains/xen1.example.com/disk.img,xvda2,w', ] [...] ... to ... [...] disk = [ 'phy:/dev/vg0/xen1_swap,xvda1,w', 'phy:/dev/vg0/xen1_root,xvda2,w', ] [...] lvm to img dd if=/dev/VolGroup00/migrationtesting_rootimg of=/root/migrationtesting.img bs=4096 conv=noerror Method 2 Create a 10 gig image file, Change this according to how much space customer is using (IE a little more then what is being used) dd if=/dev/zero of=/root/migrationtesting.img bs=1M count=1 seek=10240 #format it mkfs.ext3 migrationtesting.img #Mount it mkdir /root/migratingtesting mount -o loop migratingtesting.img migratingtesting #Copy the mounted files over from hyperVM and unmount afterward cp -rp /home/xen/migrationtesting.vm/mnt/* /root/migratingtesting umount /root/migratingtesting #xen aptitude install xen-hypervisor-4.1 xen-linux-system xen-utils xen-tools bridge-utils dpkg-divert --divert /etc/grub.d/08_linux_xen --rename /etc/grub.d/20_linux_xen #undo dpkg-divert --rename --remove /etc/grub.d/20_linux_xen
samedi 22 juin 2013
xen
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire