Recently i had to deploy a win2k3 server on Xen.
I had a few problems along the way.
1. Had a dog-slow old Centos 5.4 based server with several vm’s running on it.
2. Had to relocate one image to a new faster server via disk backup because of various reasons.
3. Had to import an existing Xen production image to the new server.
4. The new faster Centos 5.6 based server was a standard install and not installed with Xen.
So here goes:
Shutdown host on existing server.
command: virsh shutdown mymachine (mymachine the host to be moved)
Backup to external drive witch is formatted with ntfs.
For this to work i needed fuse and fuse-ntfs.
Install rpmforge
rpm –import http://apt.sw.be/RPM-GPG-KEY.dag.txt
rpm -i rpmforge-release-0.5.2-2.el5.rf.*.rpm
yum install fuse fuse-ntfs-3g dkms dkms-fuse
Backup existing image
cp -v /var/lib/xen/images/mymachine.img /mnt/exthdd/
umount /mnt/exthdd
Change existing Centos install to Xen host.
yum update
reboot if newer kernel was installed
Install Xen
yum groupinstall virtualization
chkconfig xend on
chkconfig libvirtd on
After reboot, edit the grub configuration file to make sure the system boots with xen based kernel.
vi /boot/grub/grub.conf and set the xen based kernal as the default. In this case 1
##############################################################
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/sda3
# initrd /initrd-version.img
#boot=/dev/sda
default=1
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-238.12.1.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-238.12.1.el5 ro root=LABEL=/
initrd /initrd-2.6.18-238.12.1.el5.img
title CentOS (2.6.18-238.12.1.el5xen)
root (hd0,0)
kernel /xen.gz-2.6.18-238.12.1.el5
module /vmlinuz-2.6.18-238.12.1.el5xen ro root=LABEL=/
module /initrd-2.6.18-238.12.1.el5xen.img
title CentOS (2.6.18-238.9.1.el5xen)
root (hd0,0)
kernel /xen.gz-2.6.18-238.9.1.el5
module /vmlinuz-2.6.18-238.9.1.el5xen ro root=LABEL=/
module /initrd-2.6.18-238.9.1.el5xen.img
title CentOS (2.6.18-238.9.1.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-238.9.1.el5 ro root=LABEL=/
initrd /initrd-2.6.18-238.9.1.el5.img
title CentOS (2.6.18-194.32.1.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-194.32.1.el5 ro root=LABEL=/
initrd /initrd-2.6.18-194.32.1.el5.img
##############################################################
Reboot
Check if you are running xen kernel.
Linux myserver 2.6.18-238.12.1.el5xen #1 SMP Tue May 31 14:02:29 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux
Test host disk performance.
Test 1:
#hdparm -tT /dev/sda1
/dev/sda1:
Timing cached reads: 3696 MB in 2.00 seconds = 1847.92 MB/sec
Timing buffered disk reads: 100 MB in 1.19 seconds = 84.15 MB/sec
Pretty descent.
Test 2:
#dd if=/dev/zero of=./test1024M bs=1024k count=1024 conv=fsync
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 16.5377 seconds, 64.9 MB/s
Also pretty descent.
Restore image from backup on new server:
cp -v mymachine.img /var/lib/libvirt/images/
Import existing disk image with Virtual Machine Manager. I used VMM with Ubuntu Maverick Meerkat.
The Windows 2003 server was now up and running after assigning 1 CPU and 1024Mb of ram to the Virtual Machine with VM Manager.
Performance was however still sluggish with high (up to 60.5%wa) in top. Write speed was terrible to say the least.
Found a post on another forum telling me to disable ACPI.
“If your Windows installation is set to use ACPI (this is the default), kvm can be quite slow or not work at all. This is due to Windows heavily using a register that has a very large virtualization penalty.
Fortunately, there is a simple workaround available: disable ACPI support in Windows. The procedure for doing this is:
Select “My Computer” with the right mouse button.
Select “Properties”.
Choose the “Hardware” tab.
Click the “Device Manager” button.
Select the entry under “Computer” with the right mouse button. If it says “Standard PC”, then there’s no need to do anything.
Select “Properties”
Click the “Update Driver” button.
Choose “No, not this time” and click “Next”.
Choose “Install from a list” and click “Next”.
Choose “Don’t search” and click “Next”.
Click “Next”.
Choose “Standard PC” and click “Next”.
Continue clicking “Next” and reboot the virtual machine.
If you’re installing Windows XP/2000, you can get it to use the Standard PC HAL by pressing F7 when it asks for drivers (”Press F6 for…”), there is no visual indication. If you would rather select the right HAL from a list visually then press F5 instead.”
BTW: Thanx for the info testy http://www.peakscale.com/archives/gridvm/xen-vs-kvm/
Then, i installed the Xen drivers found at http://wiki.xensource.com/xenwiki/XenWindowsGplPv
This case i used: http://www.meadowcourt.org/downloads/gplpv_2003x32_0.11.0.238.msi as i was using a 32 bit version of Win2k3.
Results:
Local Backup on the Win2k3 VM using Uranium Backup free before migration: “Time taken for last execution: 6 Hours, 39 Minutes, 35 Seconds”
Local Backup on the Win2k3 VM using Uranium Backup free after migration, disabling ACPI and installing Xen drivers: “Time taken for last execution: 0 Hours, 4 Minutes, 53 Seconds”
Size ~ 4Gig
References:
http://southbrain.com/south/2009/08/xen-drivers-for-windows-2003-m.html
http://blog.surfulater.com/2007/01/10/xen-and-the-art-of-virtualization/