VMware Cloud Community
shank15217
Contributor
Contributor

Steps for taking a XEN paravirtualized RHEL 5.X to VMware ESXi 3.5.X vm

Steps assume advanced VMware and Xen knowledge.

Xen -> VMware VM migration steps (Kernel step)

The kernel on the VM to be migrated must support fully virtualized operation. The kernels used for para-virtulized machines using RHEL 5 as a guest does not support fully virtualized operation by default. The best way to deal with this is to also install a standard kernel in the machine, port the machine and finally remove the Xen kernel.

1. Download a kernel with the same version number and architecture as the xen kernel, except it should be the generic kernel

2. Use RPM tools to install the kernel.

3. Modify /etc/modprobe.conf (this step is specific to RHEL 5 Xen VM because RHEL5 will not load LSI scsi modules during boot)

add:

alias eth0 e1000

alias scsi_hostadapter mptbase

alias scsi_hostadapter1 mptspi

alias scsi_hostadapter2 ata_piix

optionally remove:

alias scsi_hostadapter xenblk

4 Backup the old initrd file in /boot

5. Update initrd with the following command mkinitrd /boot/initrd-kernelversion.img /boot/kernelversion ex. kernelversion=2.6.18-92.el5

6. Test the new kernel by booting Xen in fully virtualized mode.

7. Port the disk over as outlined below.

Xen -> VMware VM migration steps (DISK step)

Packages

1. Download qemu from DAG repository.

2. Download VMware Server 2.0

3. Provision a real machine with RHEL5.X or Centos 5.X and install both rpms.

Steps

1. Convert raw .img file to .vmdk file using qemu-img. qemu-img convert testvm.img -O vmdk testvm.vmdk

The vmdk file will be the following format.

0 : single growable virtual disk (IDE, VM hardware type 4)

1 : growable virtual disk split in 2GB files

2 : preallocated virtual disk

3 : preallocated virtual disk split in 2GB files

4 : preallocated ESX-type virtual disk

5 : compressed disk optimized for streaming

Fast Steps (for testing)

A2. Convert .vmdk file to the proper format using vmware-vdiskmanager, vmware-vdiskmanager -r testvm.vmdk -t 4 testvmesx.vmdk

The resulting file(s) will be the following format.

0 : single growable virtual disk

1 : growable virtual disk split in 2GB files

2 : preallocated virtual disk

3 : preallocated virtual disk split in 2GB files

4 : preallocated ESX-type virtual disk (IDE, VM hardware type 4) Not supported by VMware ESX! but works..

5 : compressed disk optimized for streaming

A3. Provision a machine on ESX server and add the disk, VMware will warn the user that the disk geometry is IDE and its using a SCSI controller to access the disk.

Correct Steps

B2. Provision a VM on the VMware Server that can be used for disk imaging. VMware Server supports both IDE and SCSI drives. It is required to do the disk imaging inside a VM because the VM will not see the VMware disk metadata and will treat the disk as a regular block device.

B3. Create a SCSI disk of the same (virtual) size as the converted .vmdk disk.

B4. Add both SCSI disk and the converted IDE disk to the vm.

B5. Use the VM to dd / winimage the source converted IDE disk to the target SCSI disk. The SCSI disk will now have the data from the IDE disk.

B6. Convert the new .vmdk file to the proper format using vmware-vdiskmanager

The resulting file(s) will be the following format.

0 : single growable virtual disk

1 : growable virtual disk split in 2GB files

2 : preallocated virtual disk

3 : preallocated virtual disk split in 2GB files

4 : preallocated ESX-type virtual disk (SCSI, VM hardware type 7) Not supported by VMware ESX!

5 : compressed disk optimized for streaming

B7. Open up the *.vmdk meta file. It will be the small file that doesn't have 'flat' as a part of the filename and change db.virtualHWVersion = "X" to 4. The resulting file is supported by ESX server.

B8. Provision a machine on ESX server and add the disk.

B9. If source machine was a XEN para-virtualized machine it will probably try to boot to the XEN kernel by default. If a boot manager is installed it will go back to the grub kernel selection screen where the non XEN kernel can be booted from.

B10. Remove the Xen kernel to streamline the boot process

Reply
0 Kudos
2 Replies
raonitimo
Contributor
Contributor

There is only one small extra step (at least in my case) that is to undo xen's tty redirection.

Edit the file /etc/inittab and comment the line:

co:2345:respawn:/sbin/agetty xvc0 9600 vt100-nav

and uncomment the lines (at least one of them):

#1:2345:respawn:/sbin/mingetty tty1

#2:2345:respawn:/sbin/mingetty tty2

#3:2345:respawn:/sbin/mingetty tty3

#4:2345:respawn:/sbin/mingetty tty4

#5:2345:respawn:/sbin/mingetty tty5

#6:2345:respawn:/sbin/mingetty tty6

This will prevent you form getting the following error message:

init: Id "co" respawning too fast: disabled for 5 minutes

Reply
0 Kudos
MJ42
Contributor
Contributor

Hi, I am getting the following error on Kernel step 5 and not sure how to fix this. Any assitance would be helpful. Thanks.

# /sbin/mkinitrd -v /boot/initrd-2.6.18-128.4.1.el5.img 2.6.18-128.4.1.el5

Creating initramfs

Looking for deps of module ehci-hcd

Looking for deps of module ohci-hcd

Looking for deps of module uhci-hcd

Looking for deps of module ext3: jbd

Looking for deps of module jbd

Looking for driver for device xvda2

Looking for deps of module xenblk

No module xenblk found for kernel 2.6.18-128.4.1.el5, aborting.

Reply
0 Kudos