|

Setting Up Xen DomU on Fedora Linux (Fedora 12)

Xen DomU on Modern Linux Systems

Xen remains production-grade virtualization for specific use cases (AWS EC2, Citrix Hypervisor), but most Linux distributions default to KVM. This guide covers Xen DomU setup using modern tools and practices. For new deployments, evaluate KVM/libvirt or container solutions like Podman/Kubernetes first.

Storage Setup

Create a file-backed virtual block device (VBD) for your DomU. File-backed storage simplifies cloning but carries higher I/O overhead—use LVM or raw partitions for I/O-intensive workloads.

Create a 20GB sparse file:

dd if=/dev/zero of=/lhome/xen/f12install/vmdisk0 bs=1M seek=20480 count=1

Note: Modern dd handles larger block sizes efficiently. Adjust bs based on your storage backend performance characteristics.

Network Installation

Download the pxeboot kernel and initrd from Fedora’s archive repository:

cd /lhome/xen/f12install/
wget https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/12/Fedora/x86_64/os/images/pxeboot/vmlinuz
wget https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/12/Fedora/x86_64/os/images/pxeboot/initrd.img

The current xl tool replaces the deprecated xm command. Create an installation configuration file f12.install:

name="F12INSTALL"
vcpus=2
memory=2048
disk = ['file:/lhome/xen/f12install/vmdisk0,xvda,w' ]
vif = [ 'bridge=eth0' ]
kernel = "/lhome/xen/f12install/vmlinuz"
ramdisk = "/lhome/xen/f12install/initrd.img"
on_reboot = 'restart'
on_crash = 'restart'

Launch the installation DomU and attach to its console:

xl create -c f12.install

Detach from console with Ctrl+]. Reconnect later with:

xl console F12INSTALL

During installation, configure networking (gateway/DNS) according to your environment. Use this installation source URL:

https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/12/Fedora/x86_64/os/

After installation completes, shut down the DomU:

xl shutdown F12INSTALL

Running DomU with PyGrub

For production DomU instances, use PyGrub as the bootloader to manage kernels from within the guest rather than the Dom0 filesystem. This simplifies kernel updates and maintenance.

Create a production profile vm-10.0.0.123.run:

name="10.0.0.123"
vcpus=2
memory=2048
disk = ['file:/lhome/xen/vm-10.0.0.123/vmdisk0,xvda,w' ]
vif = [ 'bridge=eth0' ]
bootloader = "/usr/bin/pygrub"
on_reboot = 'restart'
on_crash = 'restart'

Start the DomU:

xl create vm-10.0.0.123.run

Access the console:

xl console 10.0.0.123

Update the guest kernel and system packages immediately after first boot. Modern kernels (5.x+) are more stable under Xen than older 2.6.x kernels.

Performance Considerations

File-backed VBDs introduce measurable I/O latency due to Dom0 filesystem overhead. For production deployments:

  • Use LVM-backed VBDs (phy: instead of file:) for better I/O performance
  • Consider raw disk partitions for maximum throughput
  • Monitor Dom0 CPU usage—file-backed I/O is CPU-intensive

Duplication and Scaling

Clone existing DomU instances by copying the VBD file and creating new configuration files with different names/IPs. This approach is practical for test environments but less suitable for production infrastructure management—use configuration management tools (Ansible, Puppet) or Xen-specific orchestration (OpenStack) at scale.

Modern Alternatives

  • KVM/libvirt: Default for most Linux distributions; better community support
  • Podman/Kubernetes: Container-based workloads with simpler operational overhead
  • Cloud platforms: AWS (Nitro), Azure, GCP offer managed virtualization

Xen remains valid for specific workloads requiring tight resource control and mature paravirtual I/O, but evaluate newer technologies before committing to new Xen deployments.

Similar Posts

18 Comments

  1. 您好,我按照您的方法,在fedora12X86_64上安装了xen4.0。启动xen 4.0 fedora 2.6.32.13后,正常登录,xen测试正常,但是在执行
    # xm create -c f12.install
    initial ….

    initializing cgroup subsys net_cls 此步运行较长时间,宿主机的网络符号一直在运行,过了一会才显示正常。
    但后面就停了,无法进入虚拟机的console

    注:我xen 4.0 fedora宿主机的IP采用DHCP。

      1. [czm@cx003 ~]$ ifconfig
        eth0 Link encap:Ethernet HWaddr C8:0A:A9:0F:4E:E9
        inet addr:192.168.0.3 Bcast:192.168.0.255 Mask:255.255.255.0
        UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
        RX packets:8050 errors:0 dropped:0 overruns:0 frame:0
        TX packets:3889 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:0
        RX bytes:3292683 (3.1 MiB) TX bytes:410673 (401.0 KiB)

        lo Link encap:Local Loopback
        inet addr:127.0.0.1 Mask:255.0.0.0
        UP LOOPBACK RUNNING MTU:16436 Metric:1
        RX packets:8 errors:0 dropped:0 overruns:0 frame:0
        TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:0
        RX bytes:400 (400.0 b) TX bytes:400 (400.0 b)

        peth0 Link encap:Ethernet HWaddr C8:0A:A9:0F:4E:E9
        UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1
        RX packets:8059 errors:0 dropped:0 overruns:0 frame:0
        TX packets:3901 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:1000
        RX bytes:3414174 (3.2 MiB) TX bytes:413271 (403.5 KiB)
        Interrupt:177

        vif2.0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF
        UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1
        RX packets:0 errors:0 dropped:0 overruns:0 frame:0
        TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:32
        RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

        virbr0 Link encap:Ethernet HWaddr 66:CE:8E:8C:35:86
        inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
        UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
        RX packets:0 errors:0 dropped:0 overruns:0 frame:0
        TX packets:28 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:0
        RX bytes:0 (0.0 b) TX bytes:4491 (4.3 KiB)

        [czm@cx003 ~]$

        +++++++++++++++++++++++++++++++++++++++++++++++
        vi ifcfg-eth0

        # Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller
        DEVICE=eth0
        HWADDR=c8:0a:a9:0f:4e:e9
        ONBOOT=yes
        BOOTPROTO=dhcp
        TYPE=Ethernet
        NM_CONTROLLED=yes
        USERCTL=yes
        IPV6INIT=no
        PEERROUTES=yes
        NAME=”System eth0″
        UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
        PREFIX=24
        PEERDNS=yes


  2. # xm create -c f12.install
    and after finishing the installation.At the last window:
    It shows “Congratlation..”.
    I check [reboot] it.
    But when I try :
    # xm console F12INSTALL

    It loops back to the first window which met during “xm create -c f12.install”.

    1. I see. The reboot use the old configuration for this DomU, so it goes back to the installation process.

      Please first shutdown the VM by ‘xm shutdown F12INSTALL’. Then change the configuration for this VM. You can start the VM again and it will boots with the kernel in its /boot (if configure the bootloader as pygrub).

  3. When creating vm,there are definitions for kernel and ramdisk in installation file-f12.install.
    […
    kernel = “/lhome/xen/f12install/vmlinuz”
    ramdisk = “/lhome/xen/f12install/initrd.img”

    ]

    However,during starting the vm,there are no definitions for kernel and ramdisk in installation file-vm-10.0.0.123.run. Why?Where are kernel and ramdisk?

  4. “Start DomU
    Remember to update your system after the first boot.”

    (1)Q1:
    Does it mean we had better update host PC’s fedora? Or guest VM’s fedora?
    (2)Q2:
    Maybe “after” should be changed to “before”?

  5. My content of file domu1.run :

    name=”f20install”
    vcpus=2
    memory=1024
    disk = [‘file:/home/shhpeng/Xen-dev/domu1.img,xvda,w’]
    vif = [ ‘bridge=xenbr0’ ]
    kernel=”/home/shhpeng/Xen-dev/vmlinuz”
    ramdisk=”/home/shhpeng/Xen-dev/initrd.img”

    on_reboot = ‘restart’
    on_crash = ‘restart’

    when I run : # xl create -c domu1.run
    There is error:

    dracut FATAL: No or empty root= argument

    How to deal with this?

  6. When domu1.run is the following:

    name=”f20install”
    vcpus=2
    memory=1024
    disk = [‘file:/home/shhpeng/Xen-dev/domu1.img,xvda,w’]
    vif = [ ‘bridge=xenbr0’ ]
    kernel=”/home/shhpeng/Xen-dev/vmlinuz”
    ramdisk=”/home/shhpeng/Xen-dev/initrd.img”
    extra=”root=live://******************/squashfs.img”
    on_reboot = ‘restart’
    on_crash = ‘restart’

    There is error:

    dracut FATAL: Don’t know how to handle ‘root=live://******************/squashfs.img ‘

    How to solve this ?

    Thank you

      1. Yes , I check the link “http://www.systutorials.com/5609/creating-fedora-20-domain-u-on-fedora-20-domain-0/”, but it has problem as described above .

  7. Can this guide be updated to Fedora 34 instead of the patent “everything is the same, but different for later versions” guidance?
    Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *