Monthly Archives: August 2012

How to convert a vmware linux virtual machine to xenserver virtual machine

As the title of this documents says, this document describes how to convert a vmware virtual machine to xenserver virtual machine. Although so far this procedure hasn't fail, please use this procedure on your own risk.

1. Install quemu on the vmware Server or another Linux machine (on debian based distribution use apt-get install qemu-utils, on centos use yum install qemu)

2. Uninstall vmware modules on the vmware guest you wish to convert

3. Stop the vmware guest

4. Check the format of the vmdk file:

qemu-img info guest22-flat.vmdk
image: fooguest22-flat.vmdk
file format: raw
virtual size: 15G
disk size: 15G

5. If the file format is "raw", we need not convert the image file using qemu-img convert, just rename to .img file. If it is not "raw", use "qemu-img" to convert the image to raw format.

6. Convert the file with qemu-img
[codesyntax lang="bash"]

qemu-img convert guest22-flat.vmdk -O raw /volumes/guest22/guest22.img

[/codesyntax]

7. Copy the image file to the xen server with scp or rsync
[codesyntax lang="bash"]

rsync -avz --stats --progress --partial /volumes/guest22/guest22.img root@xenserver:~/

[/codesyntax]

8. Create a guest with at least the same disk size and amount of RAM as the imported vmware virtual disk. Rename the disk under properties so you can locate it later (your_disk_name).
9. Open a console or connect to the xen server with ssh and find the disk copy the uuid of the host

[codesyntax lang="bash"]

xe vdi-list name-label=your_disk_name

[/codesyntax]

uuid ( RO)                : 565c8fcf-5a52-4f05-8fd0-de943b99fa12
          name-label ( RW): your_disk_name
    name-description ( RW): your_disk_name description
             sr-uuid ( RO): 81c5bb77-8fe5-628e-f407-73b07b7054cd
        virtual-size ( RO): 8589934592
            sharable ( RO): false
           read-only ( RO): false

10. Import the image (use the uuid from the step 9)
[codesyntax lang="bash"]

xe vdi-import uuid=565c8fcf-5a52-4f05-8fd0-de943b99fa12 filename=guest22.img

[/codesyntax]

11. Fire up your converted xen image. You may have to modify the grub boot loader vmware uses /dev/sda for it’s HD and xen uses /dev/hda.

12. If you machine does not boot press e at the grub prompt an search for root=/dev/sda1 line and change it to root=/dev/hda1 please change this in you grub.conf once the machine has booted and save your changes

Note: if your vmware guest has multiple 2G vmdk files you need to merge all of them into one single file. Please consult the page: https://sysadmin.compxtreme.ro/vmware-how-do-you-merge-multiple-2gb-disk-files-to-single-vmdk-file/

What to do when "VMware Infrastructure Web Access" stuck to "Loading..."

This document describes what do you need to do when page of VMware Infrastructure Web Access stuck to Loading... and nothing appears in your browser.

1. Edit /etc/vmware/webAccess/proxy.properties
[codesyntax lang="bash"]

vim /etc/vmware/webAccess/proxy.properties
:%s/proxy.noCache = false/proxy.noCache = true
:wq

[/codesyntax]

2. Restart the vmware-mgmt service:
[codesyntax lang="bash"]

/etc/init.d/vmware-mgmt restart

[/codesyntax]

xen vm gzip export import

To export just leave the filename blank as in this example:
[codesyntax lang="bash"]

xe vm-export vm=VM-UUID filename= | gzip -c > /mnt/vm.xva.gz

[/codesyntax]

To import use /dev/stdin as filename:
[codesyntax lang="bash"]

gunzip -c /mnt/vm.xva.gz | xe vm-import sr-uuid=SR-UUID filename=/dev/stdin

[/codesyntax]

Vmware: How do you merge multiple 2GB disk files to single vmdk file

In case of the 2GB split disk format, your virtual disk consists of multiple data files (e.g. <vmname>-sNNN.vmdk) and one header/descriptor file (<vmname>.vmdk) which describes the virtual disk. In the vmware-vdiskmanager command, it's only the header/descriptor vmdk which you need to supply as the source virtual disk.

Convert to a pre-allocated disk.
[codesyntax lang="bash"]

vmware-vdiskmanager -r sourceDisk.vmdk -t 2 destinationDisk.vmdk

[/codesyntax]

The following line is simply changing a pre-allocated input disk into a growable target disk.
[codesyntax lang="bash"]

vmware-vdiskmanager -r sourceDisk.vmdk -t 0 destinationDisk.vmdk

[/codesyntax]