3/15/2014

How to Migrate a rhel5 kvm to hyper-v


# make a directory for the virtual machine on the hyper-v 2012 vhost
mkdir C:\RHEL5-VM

# smb mount the KVM file system
net use \\kvm-server.mydomain.com\kvm-disk-share z:

# change to the mounted file system
cd \\kvm-server.mydomain.com\kvm-disk-share

# copy the KVM disk to the Hyper-V server
copy rhel5.disk C:\RHEL5-VM

# unmount the smb mounted KVM file system
net use \\kvm-server.mydomain.com\kvm-disk-share /delete

# download the vhdtool from Microsoft
http://archive.msdn.microsoft.com/vhdtool/

# append a vhd header to the raw disk file
PS C:\disks> .\VHDTool.exe /convert .\rhel5.disk

# rename the raw disk file as a .vhd file
PS C:\disks> ren .\rhel5.disk .\rhel5.vhd

# the following is a known problem after RHEL5.9

Reading all physical volumes
No volume groups found
Volume group "VolGroup00" not found
(Unable to access resume device (/dev/VolGroup00/LogVol01)
mount could not find filesystem '/dev/root'


Kernel Panic

#the following is the known solution after RHEL5.9

Booting after updating from RHEL 5.8 to 5.9 on Hyper V guest fails with a kernel panic.
Updated February 11 2013 at 11:48 PM

https://access.redhat.com/site/solutions/298243

Resolution

# download the rhel5 install media from rhn.redhat.com

# configure the settings for the vm to boot from the .iso image

#boot to : linux rescue

# chroot to the mounted filesystem
chroot /mnt/sysimage

# add following in /etc/modprobe.conf

alias eth0 hv_netvsc
alias scsi_hostadapter hv_storvsc

# run following command to create a new initrd file with Hyper-V modules.

mkinitrd /boot/initrd-2.6.18-348.1.1.el5.img 2.6.18-348.1.1.el5 --preload hv_storvsc --preload hv_vmbus --preload hv_utils -f

Configure X server to run under Hyper-V

# edit the /etc/X11/xorg.conf file

# change Section "Device" Driver to "vesa"

# change Section "Screen" DefaultDepth to 16

# change SubSection "Display" Depth to 16


# reboot to commit changes to disk
shutdown -r now

# remove the install media from the virtual cdrom drive