Home Xen Howtos Getting Started with Xen
Thursday, 24 September 2009 10:00

Getting Started with Xen

Written by 

I'm using a Xen Virtual Server to provide my Linux students with their own machines with admin rights. This has prompted interest in Xen from a lot of people just starting out in Virtualization. Following is a quick explaination of Xen and how to get a Virtual Machine up and running as fast as possible.

Hypervisors

Xen is a hypervisor meaning that it runs above the hardware but below any OS. Traditionally when you "virtualized" an OS you'd have a computer that you logged into which you installed virtualization software on such as VMWare workstation or VirtualBox. With this software you'd start the Virtual Machine from it's GUI and install the Guest OS via CDROM. In this case you have a Host Machine (the real physical machine) and a Guest Machine (the virtualized OS). With a hypervisor ALL operating systems are virtualized. This might seem a bit strange or impossible but is very powerful and extremely effecient. The side effect is that Xen can be very complex to set up. Let me explain the Xen boot process.

Xen Boot Process

  1. Machine runs code in Master Boot Record
  2. Bootloader loads the OS kernel
  3. Xen lodges itself in memory and loads the rest of the kernel in a Virtual Machine
  4. The user logs into the first Virtual Machine and starts, stops and restarts the other Virtual Machines from there

The name for the first Virtual Machine is Dom0 - it's the privileged Domain so it has direct access to the physical hardware. All subsequent Virtual Machines that are started are called DomU - unprivileged Domains. To manage a Xen Virtual Server you log into the Privileged Domain (Dom0) and use various commands to administer the Unprivileged Domains (DomUs).

Two modes of Virtualization

Virtualizers work in one of two modes - paravirtualization or hardware (full) virtualization. The difference being that a paravirtualized DomU OS knows it's being virtualized and has extensions to allow and assist in this. Paravirtualized Operating Systems are very fast and effecient. However there are times when you won't be virtualizing an OS that has these extensions such as Windows. In this case you need to use a CPU that has hardware vitualization support and run Xen in HVM (Hardware Virtualization Mode).

Paravirtualization:

  • Runs on a lot of hardware - x86, x86-64, Itanium and PowerPC 970 with or without hardware Virtualization support
  • DomUs can be Linux, NetBSD and Solaris
  • Very fast

Full Virtualization:

  • Requires Intel or AMD cpus with Virtualization Support built in
  • DomUs can be most any unmodified OS including Windows
  • Not so fast

To get around the speed issues with Full Virtualization there are paravirtualized drivers that have been written for many Operating Systems including Windows for disk access and network cards. This allows Full Virtualization to reach the speeds of paravirtualization in these two areas without requiring further modification to the Operating System. The Linux KVM Hypervisor runsin Full Virtualization mode all the time and thus needs paravirtualized drivers.

 

 

blog comments powered by Disqus
Read 5422 times Last modified on Friday, 18 November 2011 22:17
Home Xen Howtos Getting Started with Xen