Running Windows XP in Xen from its own partition
Some months ago I made some experiments with Xen and I succeeded to install and run Windows XP as a guest using Xen 3.0. In that case Windows was located in a single file and was installed through Xen.
My purpose now is to make Xen running an already installed Windows from its own partition. Just to be more specific, this is my machine configuration:
I want to log into linux and run my existing Windows XP from its own partition on the EIDE disk.
I previously tried to reach this goal but I only got grub error "GRUB loading stage 1.5" and "Error 21", meaning an unknown error during the boot process.
After upgrading the packages Ubuntu was proposing I decided to try again and I downloaded and compiled Xen 3.0.4 (see the packages to be installed first in my other post about running Windows inside Xen):
# cd /usr/src # hg clone http://xenbits.xensource.com/xen-3.0.4-testing.hg # cd xen-3.0.4-testing.hg # make world # make installThe next steps are exactly the same I wrote here, replacing 2.6.16.13 with 2.6.16.38 as the kernel version and 3.0.2-3 with 3.0.4-1 as Xen version. I briefly report them here:
# mv /lib/tls /lib/tls.disabled # cd /boot # /sbin/depmod -a 2.6.16-xenEdit /etc/mkinitramfs/modules:
loop max_loop=64
# cd /boot # mkinitramfs -o initrd.img-2.6.16.38-xen 2.6.16.38-xen # ln -sf initrd.img-2.6.16.38-xen initrd.img-2.6-xenIn /boot/grub/menu.lst I did nothing because I already had this:
title Xen 3.0 / XenLinux 2.6 kernel /boot/xen-3.gz dom0_mem=1024000 module /boot/vmlinuz-2.6-xen root=/dev/sda1 ro module /boot/initrd.img-2.6-xen(my machine has 2GB of RAM: I reserved 1GB to Xen and I will give the other 1GB to Windows guest).
# mv /etc/udev/rules.d/xen-backend.rules /etc/udev/rules.d/92-xen-backend.rulesThen edit /etc/init.d/xend after "/proc/xen/capabilities":
if [ ! -d /var/run/xend ] ; then
mkdir -p /var/run/xend
fi
if [ ! -d /var/run/xenstored ] ; then
mkdir -p /var/run/xenstored
fi
And edit /etc/init.d/xendomains:
LOCKFILE=/var/lock/xendomainsAfter rebooting my pc I checked Xen was using 1GB only:
# xm list Name ID Mem(MiB) VCPUs State Time(s) Domain-0 0 965 2 r----- 132.5
I already knew that my pc has AMD hardware virtualization capabilities, but let's check again if it's enabled (look for svm):
# cat /proc/cpuinfo | grep svm flags : fpu tsc msr pae mce cx8 apic mtrr mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt lm 3dnowext 3dnow pni cx16 lahf_lm cmp_legacy svm cr8_legacy flags : fpu tsc msr pae mce cx8 apic mtrr mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt lm 3dnowext 3dnow pni cx16 lahf_lm cmp_legacy svm cr8_legacy # xm dmesg | grep SVM (XEN) AMD SVM Extension is enabled for cpu 0. (XEN) AMD SVM Extension is enabled for cpu 1.
And now the challenge begins!
# mkdir /etc/xen/vm # cp /etc/xen/xmexample.hvm /etc/xen/vm/winxp.hvmand make these changes to /etc/xen/vm/winxp.hvm:
name = "winxp" memory = 1024 disk = [ 'phy:/dev/sda,ioemu:hda,w', 'phy:/dev/hda,ioemu:hdb,w' ] on_poweroff = 'destroy' on_reboot = 'destroy' on_crash = 'destroy' cdrom='/dev/hdc' boot='c' sdl=1 vnc=0 vncviewer=0I reserved 1GB of memory to Windows guest, I set both my disks to be seen by the guest (my SATA disk will be seen as the first EIDE disk to boot from and my EIDE disk will be seen as the second boot disk to boot from), and I told Xen to use sdl instead of vnc.
title WinXP map (hd0,0) (hd1,0) map (hd1,0) (hd0,0) rootnoverify (hd1,0) chainloader +1 title Xen 3.0 / XenLinux 2.6 amd64 1G kernel /boot/xen-3.gz dom0_mem=1024000 module /boot/vmlinuz-2.6-xen root=/dev/sda1 ro module /boot/initrd.img-2.6-xenThe disk mapping is needed to make Windows think it's on the first disk, otherwise it won't start.
# cd /etc/xen/vm # xm create winxp.hvm Using config file "winxp.hvm". Started domain winxpA new window opened showing initially the boot process and then my usual grub menu, with the WinXP and Xen choices: it's fundamental to choose WinXP because accessing the same partition from the host and the guest (in case Xen was chosen) may be fatal.
|
|
|
|
|
|
root@am2:/etc/xen/vm# xm list Name ID Mem(MiB) VCPUs State Time(s) Domain-0 0 965 2 r----- 3451.7 winxp 2 1032 1 r----- 7542.4
Powered by Blosxom.