Installing Xen On An Ubuntu Feisty Fawn Server From The Ubuntu Repositories - Page 2

On this page

  1. )
  2. 4 Links

3 Creating Virtual Machines (domU)

Now let's create our first guest domain,, running Dapper Drake (dapper) with the IP address

xen-create-image --size=2Gb --swap=256Mb --ide \
--ip= --netmask= --gateway= --force \
--dir=/home/xen --memory=64Mb --arch=i386 --kernel=/boot/vmlinuz-2.6.19-4-server \
--initrd=/boot/initrd.img-2.6.19-4-server --debootstrap --dist=dapper \
--mirror= --passwd

A lot of switches are unnecessary here because we specified the same details in /etc/xen-tools/xen-tools.conf but it shows that you can specify the desired settings either on the command line or in /etc/xen-tools/xen-tools.conf. Please make sure that you specify --ide, otherwise your virtual machine might not boot!

(To learn more about the available options, take a look at the xen-create-image man page:

man xen-create-image


The xen-create-image command will now create the virtual machine for us. This can take a few minutes. The output should be similar to this one:

root@server1:~# xen-create-image --size=2Gb --swap=256Mb --ide \
> --ip= --netmask= --gateway= --force \
> --dir=/home/xen --memory=64Mb --arch=i386 --kernel=/boot/vmlinuz-2.6.19-4-server \
> --initrd=/boot/initrd.img-2.6.19-4-server --debootstrap --dist=dapper \
> --mirror= --passwd

General Infomation
Hostname       :
Distribution   :  dapper
Fileystem Type :  ext3

Size Information
Image size     :  2Gb
Swap size      :  256Mb
Image type     :  sparse
Memory size    :  64Mb
Kernel path    :  /boot/vmlinuz-2.6.19-4-server
Initrd path    :  /boot/initrd.img-2.6.19-4-server

Networking Information
IP Address 1   :
Netmask        :
Gateway        :

Creating swap image: /home/xen/domains/

Creating disk image: /home/xen/domains/

Creating ext3 filesystem on /home/xen/domains/

Installing your system with debootstrap mirror

Running hooks

No role script specified.  Skipping

Creating Xen configuration file
Setting up root password
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
All done

Logfile produced at:

There should now be a configuration file - /etc/xen/ Take a look at it to become familiar with virtual machines configuration files:

cat /etc/xen/

#  Configuration file for the Xen instance, created on
# Tue Jun 26 12:50:50 2007.

#  Kernel + memory size
kernel = '/boot/vmlinuz-2.6.19-4-server'

ramdisk = '/boot/initrd.img-2.6.19-4-server'

memory  = '64'

#  Disk device(s).
root    = '/dev/hda1 ro'

disk    = [ 'file:/home/xen/domains/,hda1,w', 'file:/home/xen/domains/,hda2,w' ]

#  Hostname
name    = ''

#  Networking
vif  = [ 'ip=' ]

#  Behaviour
on_poweroff = 'destroy'
on_reboot   = 'restart'
on_crash    = 'restart'

To start the virtual machine, run

xm create /etc/xen/


xm console

to log in on that virtual machine (type CTRL+] if you are at the console, or CTRL+5 if you're using PuTTY to go back to dom0), or use an SSH client to connect to it (

To get a list of running virtual machines, type

xm list

The output should look like this:

root@server1:~# xm list
Name                                      ID Mem(MiB) VCPUs State   Time(s)
Domain-0                                   0      327     1 r-----    687.7                           1       64     1 -b----     22.4

To shut down, do this:

xm shutdown

If you want vm01 to start automatically at the next boot of the system, then do this:

ln -s /etc/xen/ /etc/xen/auto

Here are the most important Xen commands:

xm create -c /path/to/config - Start a virtual machine.
xm shutdown <name> - Stop a virtual machine.
xm destroy <name> - Stop a virtual machine immediately without shutting it down. It's as if you switch off the power button.
xm list - List all running systems.
xm console <name> - Log in on a virtual machine.
xm help - List of all commands.

Let's create a second vm, with the IP address and Edgy Eft (edgy) as the operating system:

xen-create-image --size=2Gb --swap=256Mb --ide \
--ip= --netmask= --gateway= --force \
--dir=/home/xen --memory=64Mb --arch=i386 --kernel=/boot/vmlinuz-2.6.19-4-server \
--initrd=/boot/initrd.img-2.6.19-4-server --debootstrap --dist=edgy \
--mirror= --passwd

Afterwards, you can start like this:

xm create /etc/xen/

and shut it down like this:

xm shutdown

A list of all virtual machines that were created with the xen-create-image command is available under


root@server1:~# xen-list-images
Memory: 64

Memory: 64

To learn more about what you can do with xen-tools, take a look at this tutorial:


Share this page:

0 Comment(s)

Add comment