Creating a Xen Virtual Machine

  1. apprentice@xenserver:~$ time sudo xen-create-image --pygrub --fs=ext4 --install=1 --memory=2048M --arch=amd64 --passwd --vcpus=1 --bridge=xenbr0 --mac=02:04:66:55:44:01 --nameserver= --vifname=vif1 --gateway= --netmask= --lvm=vgvhosts --size=9728M --swap=512M --install-method=debootstrap --mirror= --dist=wheezy --hostname=vhost1 --ip= --boot

    Let's see that again, in more readable format:

    time sudo xen-create-image \
      --pygrub --fs=ext4 --install=1 \
      --memory=2048M --arch=amd64 --vcpus=1 --passwd \
      --bridge=xenbr0 --mac=02:04:66:55:44:01 --nameserver= --vifname=vif1 --gateway= --netmask= \
      --lvm=vgvhosts --size=9728M --swap=512M \
      --install-method=debootstrap --mirror= --dist=wheezy \
      --hostname=vhost1 --ip= \


    This command does ask you for a password. For now, I'm fine with that.

  2. The config needs a small fix:

    apprentice@xenserver:~$ sudo sed -i 's/2048M/2048/g' /etc/xen/vhost1.cfg

    Then we can start the domain:

    apprentice@xenserver:~$ sudo xm create /etc/xen/vhost1.cfg 
    Using config file "/etc/xen/vhost1.cfg".
    Started domain vhost1 (id=2)

  3. Yes it does:

    apprentice@xenserver:~$ sudo xm console vhost1

    Debian GNU/Linux 7 vhost1 hvc0

    vhost1 login: root
    Last login: Thu Nov  7 16:35:55 CET 2013 on hvc0
    root@vhost1:~# apt-get update
    Hit wheezy Release.gpg
    Hit wheezy Release

    (You can use tcpdump to verify that traffic on eth0 of dom0 doesn't appear of eth0 of domU.)