Creating domU using image

Provided centos image, centos.img in /mnt/sdb1/xen/
In this example Im using example as my domain name and centos image will be named as example.img

generate uuid for the domain and then create file example in /etc/xen/
[root@virtual]# uuidgen
659042a2-7c8f-4975-9dbf-b9a4113c094c  **This uuid will be use to create domU
[root@virtual]# vi /etc/xen/example

# Automatically generated xen config file
name = “example”
memory = “128″
disk = [ 'tap:aio:/mnt/sdb1/xen/example.img,xvda,w', ]
vif = [ 'mac=02:23:3e:8f:d0:6c, bridge=xenbr0', ]
uuid = “659042a2-7c8f-4975-9dbf-b9a4113c094c”
bootloader=”/usr/bin/pygrub”
vcpus=1
on_reboot   = ‘restart’
on_crash    = ‘restart’
sdl = 0
vnc = 1
vncunused = 1
keymap = “en-us”

Copy the centos image, to the image as you describe in the exampple file before
[root@virtual]# cp /mnt/sdb1/xen/centos.img /mnt/sdb1/xen/example.img

Now, you have to create domU
[root@virtual]# xm create -c example

It might take a moment to create domU. Next, after domain example is created, you have to give IP to the domain. First, you have to login into the domU.
[root@virtual]# xm console example
[root@virtual]# vi /etc/sysconfig/network-scripts/ifcfg-eth0

# Broadcom Corporation NetXtreme BCM5704 Gigabit Ethernet
DEVICE=eth0
BROADCAST=xxx.xxx.xxx.xxx
HWADDR=00:14:5e:bb:69:9e
IPADDR=xxx.xxx.xxx.xxx        // Change the IP Address
NETMASK=255.255.255.0
NETWORK=xxx.xxx.xxx.xxx
ONBOOT=yes
TYPE=Ethernet
GATEWAY=xxx.xxx.xxx.xxx
USERCTL=no
IPV6INIT=no
PEERDNS=yes

Now, restart your network and you’re set to use domain example :)


Leave a Reply

Get Adobe Flash playerPlugin by wpburn.com wordpress themes