Xen hypervisor

Last updated: 2013-07-06

I would like to get a thin virtual host to be host for some OS’s amongst Windows 8.

A few years ago I was playing – for a short while with Hyper-V Server 2008 without GUI. I suppose I did not find a nice Quick-start for Shell setup of the guests. Remote setup was not possible due to lack of HW.

Hyper-V Server 2012 still has no GUI. It is easiest to manage the server remotely with Hyper-V Manager.

So now I am looking around for a replacement.

Windows 8 Pro is now an option, but it requires a lot of RAM and disk. The good thing is that it  puts the VM to sleep, when you close the lit on a laptop.

This article: http://searchservervirtualization.techtarget.com/resources/Open-source-virtualization mentiones a few options: Commercial: VMware, Hyper-V, XenServer. Open Source: Red Hat’s KVM, Sun VirtualBox, OpenVZ.

This articel: http://searchservervirtualization.techtarget.com/feature/Xen-vs-KVM-Linux-virtualization-hypervisors favors Xen.

Here is a place to start http://www.xen.org/products/xenhyp.html with Xen.

Here you find links to Host and Guest installs: http://wiki.xen.org/wiki/Xen_Overview. It leaves one with the question: Which Host to use?

Installing Win8 side-by-side

I realized I didn’t want Windows to be slowed further by running virtual in PV on HVM, so instead of running virtual with Win8 I installed them side-by-side in two partitions on one HD.

While running Win8 setup I partitioned the disk as follows:

  1. 2000 MB reserved for a Xen Host (NTFS – Primary)
  2. 350 MB Windows System Reserved (NTFS – Primary)
  3. 100.000 MB Win8 (NTFS – Primary, Boot)
  4. The rest (Unallocated)

After installing Win8 I ran – Search – Settings – “Administrative Tools” – “Computer Management” – “Disk Management”. This tool gives more choises than the one during setup.
(Why is it so hard to find nowadays? Well I could also go Explorer – Computer – Manage)

I deleted first partition, so it became unallocated and I created an empty extended partition at the end of the drive. Now I could install Win8 once again in the extended partition, where I assigned yet 100.000 MB for it, so now the disk looks like:

  1. 2000 MB reserved for a Xen Host (Unallocated)
  2. 350 MB Windows System Reserved (NTFS – Primary)
  3. 100.000 MB Win8 (NTFS – Primary, Boot)
  4. 100.000 MB Win8 (NTFS – Extended)
  5. 274.936 MB The rest (Extended)

The boot menu now contains two Windows 8 entries. They need names:

Explorer – Computer – Properties – “Adv system settings” – “Startup and Recovery” – Arg!  I cannot edit the boot file from inhere anymore.

I found a couple of other choises:

Search – msconfig. This program didn’t allow changing names either, but it gave more choises than above.

Next was: CMD – Run-as-admin – > bcdedit.

This is a command line tool, so now it is with risk to destroy something. (So now I could just as well be playing with commands-I-never-can-remember-anyway in Linux – Yes, you guessed it – I am not an admin-freak).

I did: >bcdedit /set {current} description “Win8 No.1”

Installing Fedora to be Xen Host

Next I want to continue with some Xen Host.

Fedora has a program for installing the setup file on an usb-key. Execute that program (as administrator) – Live USB Creator.
First you need to choose between 32 bit (i686) or 64 bit (x86_64) downloads. At the same time you need to decide desktop: KDE or Gnome (Desktop edition).
Next you optional can set storage to some free space – maybe all. This will be an extra drive for you, if you chooses to use the USB as your portable OS, that you can execute on any PC, that lets you boot on USB. This is like 25 years ago, when we ran the OS – from a 5½ inch floppy – at that time only 1.2 MB! My Fedora OS today is 1000 times larger.

I Installed Fedora 17. I didn’t need instruction while installing. It was self-explaining.

During install you get the choice to play partitions again

Select “Use free space” – Next

Select HDD (ATA / sda) – Press “->” – Next

This will automatically give you following mapping. [V] is the Linux partitions, that will be formatted.

Group or Comment Name Size Path Type
LVM Volume Group
— vg_xenhost /dev/vg_xenhost 274.921 MB
…/lv_root 51.200 MB / ext4 [V]
…/lv_home 217.984 MB /home ext4 [V]
…/lv_swap 5728 MB swap [V]
— sda /dev/sda
     Fedora Grub2 boot loader sda4 500 MB -> 2000 MB /boot ext4 [V]
free 1500 MB -> 0 MB
     Windows System Reserved sda1 350 MB ntfs
     Windows 8 sda2 99.650 MB ntfs
sda3 374.938 MB (the rest) ext
     Windows 8 — sda5 100.000 MB ntfs
     Fedora Xen Host — sda6 274.936 MB (the rest extended) /dev/vg_xenhost LVM [V]
free 1 MB
— sdb /dev/sdb
     Live USB creator (USB flash disk) sdb1 7.385 MB EFI Syst Partition

I edited sda4 to let it use the rest of the free space just after. That’s it.

Now the PC boots with the Grub boot loader first – there I can choose between Fedora and the Windows loader.

If I choose the windows loader, then I get Windows boot loader, where I can choose between the two Windows installations.

I want it to default use the Windows bootloader, so somehow I’ll have to find out how to edit the Grub menu. Here are some links:

Next I want to play with Xen.

Re-install Fedora (v 18)

Update 2013-07-06:

A Fededora security update made Java stop working – I had not sufficient Linux skills to fix the problem. So I decided to reinstall the newest Fedora (18) on to of the existing. That adventure went this way:

  • From Windows disk manager I deleted the LVM partition (sda6) with size 275 MB. The idea was to reclaim some space as the next heading “Resizing LVM” also tries to do.
  • I created a NTFS partition with size 100.000 MB. I wanted to install Win12 onto it later.
  • Once again I installed the Live USB Creator and this time chose Fedora 18 Desktop x64. After a while a bootable USB key was created.
  • Now I started to boot on the Live USB. I realized I should also delete the existing Fedora boot partion (sda4). I did that from the Fedora setup program somewhere.
  • Now Fedora partition setup could not see anything left from the old Fedora 17. The new Fedora 18 could by a click on a link claim space needed by itself. The rest of the installation went trouble-less – except for Wireless.
  • After boot with the new boot menu still Grub realized that there existed a Windows boot somewhere else on the disk – nice. All was back to normal.
  • The fix for the Wireless was to reconfigure the WLAN router to use WPA2 only with TKIP ciphering using both g and n protocols.

Now the disk looks like this

Group or Comment Name Size Path Type
LVM Volume Group
/dev/mapper 174.921 MB
…/fedora_swap 3,9 GB swap [V]
…/fedora_root 54 GB / ext4 [V]
…/fedora_home 126 GB /home ext4 [V]
— sda /dev/sda
     Fedora Grub2 boot loader /dev/sda1 524 MB /boot ext4 [V]
free 1500? MB
     Windows System Reserved /dev/sda2 367 MB ntfs
     Windows 8 /dev/sda3 104 GB ntfs
/dev/sda4 393 GB (the rest) W95 Ext d (LBA)
     Windows 8 — /dev/sda5 105 GB ntfs
     Windows 12 reserved — /dev/sda6 105 GB ntfs
     Fedora Xen Host — /dev/sda7 188 GB (the rest extended) /dev/mapper LVM [V]
free 1 MB
— sdb /dev/sdb
     Live USB creator (USB flash disk) sdb1 7.385 MB EFI Syst Partition

Getting Java to work in Firefox

Java is really messy in Linux – it seems like there is a million different howto’s on the net and none of them just makes the job simple.

Be default java is installed in Fedora already via a package called OpenJdk. If you run “Software” and search for OpenJDK, you will find several packages, if you should need to get the latest.

Before you install a newer java, you should uninstall existing browser plug-ins – and howto do that? I don’t know yet.

But in my case I think I have figured out howto install the latest java:

  • From the download page pick then not-rpm version (bin version) name “Linux x64 *”. The rpm version has to be installed for each user. Here I’ll see if it becomes available for all.
  • Log on as root: $ su
  • Install the package somewhere common for all: # cd /usr/local/bin
  • # mkdir java
  • # cp /???/tmp/jre-7u25-linux-x64.tar.gz .
  • Unpack the tarball and install Java – that will make java visible under SW: # tar zxvf jre-7u25-linux-x64.tar.gz
  • Delete the gz package.
  • Run “software”
  • search for openjdk
  • Select the new OpenJdk Runtime Envir (openjdk-1: in my case). Press “Install Package”

So here is howto verify if it is the chosen version:

  • # which java
  • # ls -l /usr/bin/java
    /usr/bin/java -> /etc/alternatives/java
  • # ls -l /etc/alternatives/java
    /etc/alternatives/java -> /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java

Seems like that part is not finished. I think there should have been link to /usr/local/bin/java/jre1.7.0_25/bin/java . I probably made too much mess already, so instead of finish this, then I will install the missing browser plugin for java called IcedTea.

Resizing LVM

I wanted a partition for VHDs. I wanted to shrink the LVM partition to give space for that. Shrink from inside Fedora is not an easy task. Instead I could do it from Windows. There are no tools out-of-the-box to resize Linux partitions with. There are several 3rd party resizers.

GnomePartionEditor can be booted from an USB or from HD, if it is added to GRUB or Windows boot loader.

It was easier for me to choose a Windows program, so I chose PartitionManagerFree. While installing it, you must press a link to a registration page in order to receive a product key and a serial no. Unfortunately the program crashed already during start-up, so it had to be given up.

So next was to try Free EaseUS®PartitionMaster HomeEdition. When I chose the LVM partition the option for resizing was removed.

Back to creating a boot USB from GnomePartitionEditor. I downloaded the .iso file and used the Windows program Rufus to create a bootable USB directly from the .iso file.

When booting from the USB

  • Start GPartedLive
  • Choose your keyboard map from full list
  • 33: for en_US to be OS langauge
  • 0: just continue to get a desktop with GParted started

The LVM partition is used 100% and cannot be resized.

It is possible to deactivate LVM – then resize. But what will be lost?

I chose operation Check after Deactivate and then Apply. Nothing informative was found. Comparing to the ShrinkFedora article, then check probably is th fsck command.

I removed the flag LVM from the partition. That didn’t help anything. Then I re-added the LVM flag, Activated the LVM partition and booted – to check if Fedora was still working. It was working fine. The utility Disks shows the devices inside the LVM.

Why can’t I see the partitions in the LVM? It should be among the features.

Ok – seems like I to use cmdline – I opened a terminal and tried:

user@debian:~$ fsck -fc /dev/vg_xenhost/lv_home

=> Permission denied when trying to open /dev/mapper/vg_xenhost-lv_home

=> You must be root

How to become root in this debian USB OS? Live USB don’t have psw on root. So one only have to add sudo infront to become root:

user@debian:~$ sudo fsck -fc /dev/vg_xenhost/lv_home

=> …. this takes a long time for 200 GB.


You might also get inspired from SlowJet.

Installing Xen on Fedora

Now I could continue installation according to an instruction from Xen on Fedora.

First install Xen. You need to be root, when installing it

  • $ yum install xen

Coming some time.


Fedora has a nice virtual manager.

FireFox starts by default on http://start.fedoraproject.org/


Later it can be interesting to look for Xen Virtual Appliances.


The End.


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: