LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-31-2007, 01:46 AM   #1
scheidel21
Senior Member
 
Registered: Feb 2003
Location: CT
Distribution: Debian 6+, CentOS 5+
Posts: 1,323

Rep: Reputation: 100Reputation: 100
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 http://www.mycomputingart.com/ 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

Quote:
kernel="/usr/lib/xen/boot/hvmloader"
builder="hvm"
memory=512
name="winxp"
vcpus=1
vif=['type=ioemu,bridge=xenbr0']
disk=['phy:/dev/sda,ioemu:hda,w','phy:/dev/sdb,ioemu:hdb,w']
device_model='/usr/lib/xen/bin/qemu-dm'
cdrom ='/dev/hda'
vnc=1
vncconsole=1
vncpasswd=1
ne2000=0
boot="c"
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.
 
Old 08-02-2007, 07:24 AM   #2
Z24
LQ Newbie
 
Registered: Aug 2007
Distribution: Ubuntu
Posts: 2

Rep: Reputation: 0
I'm glad my blog helped out.
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.
 
Old 08-05-2007, 12:04 AM   #3
scheidel21
Senior Member
 
Registered: Feb 2003
Location: CT
Distribution: Debian 6+, CentOS 5+
Posts: 1,323

Original Poster
Rep: Reputation: 100Reputation: 100
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.
 
Old 09-13-2007, 10:19 PM   #4
Slokunshialgo
Member
 
Registered: Jan 2006
Distribution: Ubuntu 9.04, Fedora 10
Posts: 76

Rep: Reputation: 17
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:
Code:
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?
 
Old 09-14-2007, 12:28 AM   #5
scheidel21
Senior Member
 
Registered: Feb 2003
Location: CT
Distribution: Debian 6+, CentOS 5+
Posts: 1,323

Original Poster
Rep: Reputation: 100Reputation: 100
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.
 
Old 09-14-2007, 12:08 PM   #6
Slokunshialgo
Member
 
Registered: Jan 2006
Distribution: Ubuntu 9.04, Fedora 10
Posts: 76

Rep: Reputation: 17
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.
Code:
kernel="/usr/lib/xen/boot/hvmloader"
builder="hvm"
memory=512
name="winxp"
vcups=1
vif=['type=ioemu,bridge=xenbr0']
disk=['phy:/dev/sda,ioemu:hda,w']
device_model='/usr/lib/xen/bin/qemu-dm'
cdrom='/dev/cdrom'
vnc=1
vncconsole=1
vncpassword=1
ne2000=0
boot="c"
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.
 
Old 09-15-2007, 02:20 AM   #7
scheidel21
Senior Member
 
Registered: Feb 2003
Location: CT
Distribution: Debian 6+, CentOS 5+
Posts: 1,323

Original Poster
Rep: Reputation: 100Reputation: 100
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.
 
Old 09-15-2007, 03:24 AM   #8
Z24
LQ Newbie
 
Registered: Aug 2007
Distribution: Ubuntu
Posts: 2

Rep: Reputation: 0
Don't you get a more specific grub error like these ones?
http://www.uruk.org/orig-grub/errors.html#stage2

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
Code:
boot='c'
instead of
Code:
boot="c"
 
Old 09-16-2007, 01:42 AM   #9
Slokunshialgo
Member
 
Registered: Jan 2006
Distribution: Ubuntu 9.04, Fedora 10
Posts: 76

Rep: Reputation: 17
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.
 
Old 12-10-2007, 04:50 PM   #10
sergiojuan
LQ Newbie
 
Registered: Nov 2004
Posts: 1

Rep: Reputation: 0
Xen and Windows 2003

Folks,
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?

Regards,

Sergio
 
Old 03-13-2008, 04:21 AM   #11
scheidel21
Senior Member
 
Registered: Feb 2003
Location: CT
Distribution: Debian 6+, CentOS 5+
Posts: 1,323

Original Poster
Rep: Reputation: 100Reputation: 100
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.
 
Old 09-01-2009, 04:00 AM   #12
kevpatts
LQ Newbie
 
Registered: May 2004
Posts: 25

Rep: Reputation: 0
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?
 
Old 09-01-2009, 07:42 AM   #13
scheidel21
Senior Member
 
Registered: Feb 2003
Location: CT
Distribution: Debian 6+, CentOS 5+
Posts: 1,323

Original Poster
Rep: Reputation: 100Reputation: 100
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.
 
Old 09-01-2009, 08:05 AM   #14
kevpatts
LQ Newbie
 
Registered: May 2004
Posts: 25

Rep: Reputation: 0
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.
 
Old 09-01-2009, 08:30 AM   #15
scheidel21
Senior Member
 
Registered: Feb 2003
Location: CT
Distribution: Debian 6+, CentOS 5+
Posts: 1,323

Original Poster
Rep: Reputation: 100Reputation: 100
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.
 
  


Reply

Tags
boot, error, existing, grub, install, partition, raid, vista, vnc, windows, xen



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
xen won't boot windows installation, everything seems ok scheidel21 Linux - Software 4 12-24-2009 10:26 AM
run existing windows partition while in feisty jaymoney Ubuntu 7 05-22-2007 03:13 PM
Run an existing Windows Partition in Linux?? wedgea18 Linux - Software 2 11-17-2006 12:59 AM
How to run RHEL 4 as guest in Xen(SLES 10 XEN) darshanbv Linux - Software 1 06-26-2006 11:21 AM
possibility to use an existing initrd for xen? kpachopoulos Linux - General 0 12-31-2005 11:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration