Windows7 VM on Xen
Posted by blogadmin on January 1, 2013
I am assuming you already have a running xen Dom0 having VM partitions in LVM.
You can refer this link for basic xen setup http://wiki.xen.org/wiki/Xen_Beginners_Guide
As said earlier HVM support is needed to run Windows VMs. To check if your processor support hvm run
xen01:~# xm info |grep hvm- xen_caps : xen-3.0-x86_64 xen-3.0-x86_32p hvm-3.0-x86_32 hvm-3.0-x86_32p hvm-3.0-x86_64
Above system supports 32 and 64 bit hvm (hvm-3.0-x86_32 hvm-3.0-x86_32p hvm-3.0-x86_64). hvm-3.0-x86_32p stands for 32 bit PAE kernels. PAE (Physical Address Extension) This feature is added to 32bit kerenels to support memory more that 4GB. Obviously there are no 64 bit PAE kernels as standard 64 bit kernel can address memory more than 4GB up to TBs.
Ensure you have xen-qemu-dm-4.0 package installed.
Create a VM config /etc/xen/windows7.cfg file as blow
kernel = "/usr/lib/xen-default/boot/hvmloader" # Use HVM default is PVM builder = 'hvm' memory = 1024 shadow_memory = 8 name = 'windows7' # Your installation iso is at /root/windwos7_Professional_32bit.iso disk = [ 'phy:g1/windows7-disk,hda,w', 'file:/root/windwos7_Professional_32bit.iso,hdc:cdrom,r' ] device_model = '/usr/lib/xen-4.0/bin/qemu-dm' # Network settings # br0 is name of the bridge. Change it as per your bridge name # The mac address should be uniq to avoid recurrent windows activation. vif = [ 'bridge=br0,mac=40:00:C0:A8:05:C9' ] # boot on floppy (a), hard disk (c) or CD-ROM (d) # default: hard disk, cd-rom, floppy #### boot must be dc to install windows after that you change it to c or cd boot = "dc" # use VNC to install and setup windows after that you can disable this vnc = 1 vncconsole = 0 vncpasswd = 'password' vncviewer = 1 vncunused = 1 vnclisten = '0.0.0.0' # number of cpu's to assign vcpus = 1 stdvga = 0 serial = 'pty' # Required for USB mouse usbdevice = 'tablet' on_poweroff = 'destroy' on_reboot = 'restart' on_crash = 'restart'
We are using LVM based vm partition so create one of size 14GB. Remember to create it more that 11 GB as windows7 needs minimum 11 GB for installation otherwise your installation will fail.
lvcreate -L 14G -n windows7-disk g1
Fire-up your VM by command
xm create /etc/xen/windows7.cfg
Connect to your Dom0 IP using VNC with password as ‘password’. VNC can be disabled after installation once you get RDP connection up. Proceed with the installation process after completion, reboot the VM.
Do not activate Windows yet. We need to install xen pv drivers for windows before.
Xen PV Drivers for Windows
It is noticed that Dom0 pauses while starting and stopping windows VMs. This is due to high I/O when windows boots. Xen PV Drivers allows using xen network and block devices in Dom0.
1. They are faster than qemu and does not hang Dom0 while booting and shutdown.
2. Installing Xen PV drivers shows network and disk read/write stats for winodws VMs in “xm top” command.
3. You get 1gbps NIC speed
Download and install Xen PV Signed Drivers from http://apt.univention.de/download/addons/gplpv-drivers/
A reboot is required after installation. After reboot you will see xen block device and network device in “Device Manager”. You can activate windows and also enable RDP now.
Note: By default ICMP is disabled in Windows XP and Windows7 firewall. Your VMs will not ping from outside. Enable ICMP requests in windows firewall if you need it.
Filed under System Administration