A couple of not-so-obvious-at-first hints if one day you need to get Windows 7 Professional running as domU on XEN 4 HVM virtualization where your dom0 is Linux Debian Squeeze. And with the assumption that it is to be bridged with eth0/peth0.
# aptitude -P install xen-linux-system # aptitude -P install xen-qemu-dm-4.0
These can be handy too:
# aptitude -P install xen-tools genisoimage
The former – a toolbox, the latter – for generating ISO image to hold GPLPV drivers for Windows.
Make sure your grub will boot your XEN kernel under XEN hypervisor: check your boot order (/etc/grub.d/??_* order) and disable checking for other OS-es on your volumes (GRUB_DISABLE_OS_PROBER=true in /etc/default/grub).
xend configuration (/etc/xen/xend-config.sxp)
Do NOT uncomment the (network-script […]) configuration statement as it will interfere with Debian’s way of handling networking. Leave (vif-script vif-bridge) though.
Having done that – decide how to manage your physical memory. If you need at least 512MB of memory for dom0 – and allow it to balloon as required – set:
(dom0-min-mem 512) (enable-dom0-ballooning yes)
Add your xend daemon to your startup:
# update-rc.d xend defaults
You might want to reboot now and check if the hypervisor boots itself (and your dom0 kernel), and to see if xend starts up properly.
Your started domain should create an interface for itself and bridge to eth0/peth0 (as assumed at the beginning). Therefore you need a functional bridge for your domains to use. See relevant /etc/network/interfaces example:
allow-hotplug eth0 iface eth0 inet manual iface br0 inet static address 192.168.0.1 netmask 255.255.255.0 bridge_ports eth0 auto br0
Make sure your dhcpd and other services are running on br0.
Domain (domU) configuration for Windows 7
For performance reasons it is advised to provide a hard disk for the domain as a block device, ideally an LVM LV (here: 300GB):
# lvcreate -L300G -nxenvm1 volumegroup
Dump your Windows 7 install DVD:
# dd if=/dev/cdrom of=/root/Win7-install.iso bs=1M
Here’s an example config file (place it somewhere in your /etc/xen/ directory):
kernel = '/usr/lib/xen-4.0/boot/hvmloader' builder = 'hvm' memory = '3072' shadow_memory = '8' device_model='/usr/lib/xen-4.0/bin/qemu-dm' disk = [ 'phy:volumegroup/xenvm1,hda,w', 'file:/root/Win7-install.iso,hdc:cdrom,r' ] name = 'xenvm1' vif = ['bridge=br0, mac=01:23:de:ad:be:ef'] # make up a good MAC and don't change it boot='dc' vnc=1 vncviewer=0 sdl=0 vcpus=2 usbdevice='tablet' # helpful with VNC console on_poweroff = 'destroy' on_reboot = 'restart' on_crash = 'restart'
Note that the VNC is not protected by a password in this example. Also pay attention to disk paths, vif statement, and of course vcpus and memory too.
Before you boot it, have a VNC Viewer nearby to connect to its console. When ready, start it:
# xm create /etc/xen/xenvm1.cfg
The installation process will start, follow it as you see fit.
Drivers and automatic startup
Some sources advise to install GPLPV drivers in Windows to make sure it uses it’s virtual HW optimally (well, for performance). Frankly – I am not sure (hey, the installation is bootable), but just to be on the safe side I installed these. Visit http://www.meadowcourt.org/downloads/ and get your MSI package into a separate directory, and put it in an ISO image:
# genisoimage -o /root/gplpv.iso your-separate-directory/
Edit your domain config and set the cdrom to the iso image, bring your Windows down, and boot it again with xm create. Yes, you can do it dynamically, but it is left as an exercise for the reader 😉
Run the MSI file. The drivers are not signed by Microsoft, so to make sure these will work you need to enable test signing mode in Windows – Start/cmd.exe and:
# bcdedit.exe /set TESTSIGNING ON
Reboot your Windows to make sure everything is OK.
To have your domain booted at your host startup (and save it’s state on shutdown) you need to symlink it’s config file to /etc/xen/auto/ and make sure xendomains is started at boot:
# update-rc.d xendomains default
- Xen – Debian wiki (wiki.debian.org)