Archive for the ‘Xen’ Category

How to prepare the disk for Fedora 8 and Xen

February 24, 2008

You should install a minimal Fedora 8 on a server that you plan to run Xen on. This includes a minimal logical volume for the host; this way you can add additional logical volumes: one for each Xen guest. Before you can do this you’ll need to understand the Fedora Logical Volume Manager (LVM2).

Let’s start with a bit of introduction. On UNIX a file-system is a structure that is defined on a set of storage devices. A storage device must be partitioned before you can create a file-system or a logical volume. Once a file-system has been created, it can be mounted on a directory.

Linux supports different types of file-systems. For example, local file-systems such as ext2, ext3, ext4, FAT, NTFS, HFS, HFS+, JFS and XFS; or network file-systems such as NFS, OpenAFS and GFS.

For Xen, a file that contains an image of a file-system is easiest for a para-virtualized virtual machine. Files that contain an image of a file-system are accessed via Xen blktap or the loop-back mechanism.

A file that contains an image of a hard disk is the easiest for a hardware virtual machine (e.g., if you plan to run an unmodified guest such as Windows). These files are accessed via hard QEMU disk emulation.

Before you can create a logical volume, you need to partition the physical drive. You do this by using the fdisk command. Next you’ll need to create a physical volume for each partition using the pvcreate command. After you’ve created a physical volume, you’ll need to add the physical volume to a volume group. You create a volume group using the command vgcreate. Next you’ll need to create a logical volume on the volume group. Finally, after you’ve created a logical volume, you are ready to create a file-system in it.

But first, here is the summary of the commands:

  1. fdisk /dev/hda
    Use the fdisk command to create one or more logical disks called partitions on the first IDE disk (hda).
  2. pvcreate /dev/hda1
    Creates a physical volume on each partition
  3. pvdisplay
    Displays the status and size of the physical volumes
  4. vgcreate VM /dev/hda1
    Add physical volume to a volume group
  5. vgdisplay VM
    Displays the status of a volume group
  6. lvcreate -L10G -n UBUNTU VM
    Creates a 10GB logical volume called UBUNTU on volume group VM. This command also creates an entry in /dev/mapper that maps the logical volume to the physical volume that it was created from. You can access a logical volume from /dev/VM/UBUNTU
  7. lvdisplay
    Displays the status and size of logical volumes

Books on Xen

February 24, 2008

I’ve found the following two books on Xen to be required reading if you’re a beginner to the world of Xen and Fedora administration. Virtualization with Xen is an excellent book to get started with Xen and how to design your first Xen system. It is packed with information that would take you a long time to gather unless you’re a Linux admin guru.Xen Virtualization is another good book to get you going. Again very strong on basic Linux administration needed to deal effectively with Xen. For a beginner to Xen, I refer to both of these book constantly as I’m extending my knowledge on Xen and find them both to be indispensable resources.

How to Create a Xen Virtual Machine

February 19, 2008

By far the easiest way to create a Xen virtual machine is to use the Red Hat Virtual Machine Manager application. But before you can create any VMs you must disable SELinux. To fully disable SELinux, edit /etc/selinux/config file and set SELINUX to disabled. After you have set up your VMs you can re-enable SELinux. Now make sure that you’ve actually installed the Virtual Machine Manager. Run the yum install virt-manager command. After you’ve disabled SELinux and installed the Virtual Machine Manager, you’re ready to install your first Xen VM within a few minutes. Here is a screen-cast for creating a Fedora based VM.

Xen boot log – xm dmesg

February 16, 2008

After you’ve managed to configure GRUB to boot with Xen on domain 0, and you actually reboot your system, you’ll see a bunch of Xen log lines zip by before you’ll see the Fedora startup process. The Xen master command xm dmesg will list the Xen hypervisor boot process. Here are a few lines from the Xen boot log.


# xm dmesg
 __  __            _____  _   ___             _____ 
 \ \/ /___ _ __   |___ / / | / _ \    _ __ __|___  |
  \  // _ \ 47_ \    |_ \ | || | | |__| 47__/ __| / / 
  /  \  __/ | | |  ___) || || |_| |__| | | (__ / /  
 /_/\_\___|_| |_| |____(_)_(_)___/   |_|  \___/_/   

http://www.cl.cam.ac.uk/netos/xen

 University of Cambridge Computer Laboratory

 Xen version 3.1.0-rc7 (mockbuild@(none)) (gcc version 4.1.2 20070925 (Red Hat 4.1.2-33)) Tue Feb 12 13:01:02 EST 2008
 Latest ChangeSet: unavailable

(XEN) Command line: /xen.gz-2.6.21-2957.fc8
(XEN)  0000000000000000 - 000000000009f000 (usable)
(XEN)  000000000009f800 - 00000000000a0000 (reserved)
(XEN)  00000000000ca000 - 00000000000cc000 (reserved)

How to tell if the CPU supports Virtualization

February 16, 2008

To run a guest unmodified (e.g., Windows) on Xen, you’ll need a CPU that supports hardware virtualization (Intel VT or AMD SVM). But how can your CPU supports virtualization or not? On you can boot the system and use the BIOS to see the hardware spec., alternatively if you run Linux, you can take a look at the/proc/cpuinfo file and see if the field vms (for Intel) or vmx (for AMD) is defined as one of the flags.

Fedora Kernel upgrade and Xen

February 15, 2008

Each time you update the Fedora kernel, e.g., by using yum update, the file /boot/grub/grub.conf gets updated to use this kernel. This may result in you being unable to boot with Xen. The solution is to modify the grub.conf file and move the Xen kernel to the top of the file, e.g. tonight when I updated Fedora 8, the new kernel was placed a head of the Xen kernel. So you’ll need to edit this file and put the Xen kernel ahead of the latest Fedora update.


title Fedora (2.6.21-2957.fc8xen)
    root (hd0, 0)
    ...
title Fedora (2.6.23.15-137.fc8)
    root (hd0,0)
    ...

How to create a domain on Xen

February 15, 2008

Use the Xen master command (xm) with the create option to create a domain on which you’ll run a new instance of your virtual operating system (aka guest OS). First, however, you’ll need to  create a domain configuration file: simply clone and edit of the Xen canned config files in /etc/xen folder, e.g., xmexample1 or xmexample2.

xm create -c mydomainconfigfile 

After you’ve created the domain, you can run xm list to check that it has been started properly (if there is an issue, you’ll see it on the terminal from which you started the xm create command)

How to install Xen on Fedora 8

February 10, 2008

Xen is a virtualization system originally developed by the University of Cambridge and is now an open source project with contributions from IBM, HP, Intel, RedHat and XenSource (Citrix). You can install Xen 3 on Fedora and thus run multiple operating systems on the same machine. The best documentation that I’ve found on how to get going is the chapter two of a book on Xen by Prabhakar Chaganti.

  1. yum intall kernel-xen xenUsing yum will be a lot easier than downloading the RPMs and then trying to make it work. I tried to get the latest experimental RPM version Xen 3.2 to work, and I gave up and used yum instead which installs the latest stable version 3.1.2.
  2. Edit /boot/grub/grub.conf and set the default kernel to 0 instead 1 (0 is for Xen and 1 is for Fedora kernel)
  3. After a reboot, you’ll be using the Xen kernel (uname -rm will confirm that you’re running with Xen) and you should be able to use the xen tools, e.g., xm list

Fedora 6 (with Xen kernel) on Thinkpad T40 – Not

May 19, 2007

FedoraLast night I tried installing Fedora 6 (with Xen virtualization) on my Thinkpad 40 laptop without success. Later I learned that Xen kernel only works on PAE enabled CPUs. During the Fedora installation, I selected the Virtualization option. After the installation was completed and T40 booted up, I got this message: Kernel panic – not syncing: cannot execute a PAE-enabled kernel on PAE-less CPU!I reinstalled Fedora without the virtualization option and T40 was up and running in no time. Except for my Comcast Internet connection. The odd thing was I had the T40 connected via a crossover cable to my Airport Extreme wireless station, and when Fedora started, my Comcast connection went down. The only way I could get the Comcast connection back up was to switch to a different cable modem, restart the modem, and then switch back to the original modem. I also disconnected T40 from the Airport Extreme. Not quite sure why my Comcast connection would go down. This happened twice after the initial 1st boot of Fedora whilst it was connected (via crossover cable) to Airport Extreme.


Follow

Get every new post delivered to your Inbox.