-   Linux - Software (
-   -   Using Xen to run existing Windows installation (

scheidel21 07-31-2007 01:46 AM

Using Xen to run existing Windows installation
I have an existing windows install on a physical disk and I was extremely excited by the idea of XEN and being able to run windows virtually from Linux for most everything except my games. Of course I don't want to have to reinstall windows and all my apps, so I want to use the existing partition. But guess what there is almost nothing out there about how to do it with XEN most articles focus on how to do it with vmware. I finally did get it to work with the help of a page I found at this was relativly obscure to find, so I am going to post the basics here so others will hopefully no have the headaches I have had.

1) You need a processor with Virtualization technology that's a given. All current AMD 65 currently have it, I believe and all core duos and duos2 do as wel I think.

2)A Xen enabled kernel running at least xen 3.0.4 I believe (I am running 3.1) How to do this I will leave up to xen documentation it explains pretty well.

3)Now once you have these in place, you will need to create the hvm file there is a sample included with xen, mine is below


cdrom ='/dev/hda'
Now most of this is easily documented elsewhere, but the key here is the disk, you will notice my config uses two physical devices for hard drives, this is because I have two sata hard drives, I initially only had one listed the hard drive with XP installed, which is sda, because linux in on sdb, GRUB is also installed in the MBR of sda. Windows is on sda1, so I originally tried to use the physical device sda1, that caused xen to load the virtual bios then stall at "Booting from hard disk". then I tried changing this to sda and grub started to boot then exited with error 21. Then after reading somewhere that error 21 means unable to locate disk I tried adding sda1 as the second virtual hard drive hdb, this caused grub to boot with error 17. Further reading from xensource forum gave me the notion that to boot from an existing hard drive I would need to mirror my actual setup. I did not try it at this point, unsure of what to do. Further research led me to a blog at the above mentioned site where someone had successfully done what I wanted to do. The key was that I did need to mirror my actual setup, with two devices one for sda and one for sdb. Grub was going all funky because it couldn't locate the second hard drive after changing my config for the domain as it is above everyhting worked like a charm.

I do hope this helps somebody and I hope when I have more time to post a better thought out and fully involved Howto on linuxquestions wiki.

Z24 08-02-2007 07:24 AM

I'm glad my blog helped out. :cool:
I would just note that such a configuration is quite risky because the grub menu that shows up in domU allows to boot from dom0 location too (the Xen partition). In that case both dom0 and domU could be destroyed.
Moreover, domU location (the Windows partition) shouldn't be mounted in dom0 while booting domU.

scheidel21 08-05-2007 12:04 AM

yea good note, although I had set my grub to boot into windows instead of linux for use by others. And of course bad things happen if you try to access the hard drive by mounting and running it. Of course now I'm out of my laptop anyways my VRAM went on the mobo and wouldn't ya know it,' it's like 500 bucks to replace. But at least I got XEN to work.

Slokunshialgo 09-13-2007 10:19 PM

I apologize for bringing up a dead topic, but why start a new one?

Anyways, using the above configuration file, I have been able to boot a VM system, but GRUB will not load. I get the following:

Booting from Hard Disk...
GRUB Loading stage2..

At this point, it just sits there, not bringing up the boot-loader for me to choose from.

The only difference in the configuration scheidel21 offered, and my own, is that I list only one disk. This is because with my configuration, I only have one drive, with Windows on sda1, Suse on sda2, and storage on sda3. I would guess that it would be able to find the boot files, but I'm likely getting ideas between virtualization and a regular boot mixed up.

Any ideas on how to get this up and running?

scheidel21 09-14-2007 12:28 AM

I know it seems moot but why don't you start by posting your hvm file your system configuration (Hardware) distro you are using and version of xen you are using. It might help us help you.

Slokunshialgo 09-14-2007 12:08 PM

hmm... I guess I've gotten a bit too used to being the one on forums who goes around and helps solve problems, not ask for help.


Running Suse 10.2
1 SATA drive
-sda1 = Windows XP
-sda2 = SuSE
-sda3 = Storage space
-sda4 = swap

Grub is installed in the MBR, with the config files in the usual /boot on sda2. Xen version 3.0.3.

scheidel21 09-15-2007 02:20 AM

I recall reading somewhere that xen 3.0.3 was broken somewhat with hvm, and one person had no success with booting an existing XP install from xen 3.0.3, I know I never did with the stock 3.0.3 debian kernels, someone said they had success with 3.0.4 and above booting an existing install. I Downloaded the source for xen 3.1 and compiled myself for my config. This may seem like a hassle but I would suggest that and see if it works. The Readme with the xen source is pretty good, and they have binary rpms too.

Z24 09-15-2007 03:24 AM

Don't you get a more specific grub error like these ones?

However, as scheidel21 wrote, Xen 3.0.4 is sure to be working with such hvm configuration; I would try with a xen upgrade.

Then, I don't think this could be the cause, but my config has

instead of


Slokunshialgo 09-16-2007 01:42 AM

As for grub errors, I get none. it just goes to Stage 2, and sits there. When I get the chance, I'll grab new source files and try installing it that way.

sergiojuan 12-10-2007 04:50 PM

Xen and Windows 2003
I have been several days trying to install Windows 2003 over Xen, but I haven't had any luck.
I made an image of the installation CD and created an .hvm file where I include the path for that image file as the cdrom, but xen continues to tell me that it cannot read for cdrom.

What am I doing wrong?



scheidel21 03-13-2008 04:21 AM

Is the 2003 disk and image or actually burned to CD? let's see your hvm config again, remember if it is a file you need to change the cdrom to the iso file to boot from.

kevpatts 09-01-2009 04:00 AM

Sorry for bringing up a very old topic, but I'm trying to do something similar to what you guys have done here, the major difference being really that I'm currently running a Ubuntu/Vista dualboot on a fakeraid array using dmraid in Ubuntu. Can the Xen kernel support this setup?

scheidel21 09-01-2009 07:42 AM

Grub should load before anything else including the fake raid, so I don't see why there should be an issue, set it up with you hard drive mapping to be the same as your physical map and boot, make sure you select Vista on boot, if you try to boot Ubuntu it will do some very bad things.

kevpatts 09-01-2009 08:05 AM

Thanks a million, it actually worked a treat. I can boot the old and new Ubuntu kernels, including the Xen one, as well as Vista with no problems. My nVidia driver isn't working with the Xen kernel, and for some reason I don't have network connectivity, but I can sort them out in due course.

Cheers, wasn't expecting that to be so easy.

scheidel21 09-01-2009 08:30 AM

If I recall there was a patch required for nvidia graphics chipsets for use with XEN you may want to do a search on that and would be more than happy to try asnd assist you with Networking as well. I had a bear of a time with that myself.

All times are GMT -5. The time now is 07:25 PM.