Virtual Disk Migration Utility 1.1: A V2V tool to convert VMware and Microsoft Virtual Server/Virtual PC virtual machines (with Microsoft Windows Virtual Machines installed) to the Xen Virtual Appliance (XVA) format. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA The GNU General Public License is also available from: http://www.gnu.org/copyleft/gpl.html CONTENTS ======== 1. Introduction 2. Files 3. Installation 4. Usage 4.1 Conversion 5. Caveats 6. References 1. INTRODUCTION =============== The Virtual Disk Migration Utility converts Windows virtual machines installed on VMware and Microsoft Virtual Server (MSVS) or Virtual PC to Xen Virtual Appliance (XVA) format. The resulting XVA can then be imported into a XenServer Family product (XenEnterprise, XenServer or XenExpress) and booted as a XenServer HVM guest. The XVA format output directory contains: i) For each virtual disk, a directory containing gzip-compressed chunks of the virtual disk. Each chunk contains up to 1GB (1e9 bytes) of data. ii) A file named ova.xml that contains configuration settings (for example, memory size and number of vCPUs). This tool relies heavily on the VDK utility (http://chitchat.at.infoseek.co.jp/VMware/vdk.html) which in turn was made possible by the FileDisk utility (http://www.acc.umu.se/~bosse). Xensource has modified and added routines to the VDK utility for the conversion to XVA to be made possible. Also, to produce the gzip-compressed chunks of the virtual disk in XVA format, the Win32 zlib library is used (http://www.zlib.net). 2. FILES ======== i) V2XVA_bin.zip - Zip file containing the executable a) README.txt - This file b) COPYING.txt - GPL license c) v2xva.exe - Virtual Disk Migration Utility d) v2xvadrv.sys - V2V device driver for mounting VMDK disks ii) V2XVA_src.zip - Source code for V2V utility 3. INSTALLATION =============== Extract v2xva.exe and v2xvadrv.sys from V2XVA_bin.zip and copy them to a folder on a local disk (NOT a network share). For VMware virtual machine conversions, v2xva.exe must be run from the same directory where v2xvadrv.sys exists. 4. USAGE ======== The Virtual Disk Migration Utility tool (v2xva.exe) can be run on Windows XP or Windows Server 2003 R2 or Windows Vista. It has not yet been tested on Windows 2000. The tool also requires i) reg.exe utility to be present for both VMware and MSVS Windows VM conversions. (reg.exe -- The Registry Manipulation Utility tool is available on Windows XP and Windows Server 2003 or can be downloaded from the Microsoft Windows Support tools available from http://www.microsoft.com/downloads) ii) For MSVS Windows VM conversions, vhdmount.exe is required. (vhdmount.exe -- The Microsoft Virtual Hard Disk mount utility comes packaged with Microsoft Virtual Server R2 SP1. It can be downloaded from http://www.microsoft.com/virtualserver) The v2xva.exe tool needs to be run with administrator privileges for the VMware VM conversion case since it installs a device driver. In a command prompt window, the user should chdir to the directory in which the utility and driver are stored, then invoke the command. v2xva.exe [/clean] [/verbose:Loud|Less|Low] [/vhdwindir:Path to Windows Directory of mounted VHD boot partition] /config:{Config-file} [/output:Path to output directory for XVA files] Options: /clean - Reset Virtual Disk Migration Utility device driver state for VMware VMDK conversions. This option does not have any affect for Microsoft VHD conversions. Any other specified options are ignored. /verbose - Output more information as conversion process proceeds Loud: Output all information Less: Output lesser information Low: Output minimal information (default) /vhdwindir - Path to Windows Directory of mounted VHD boot partition Other parameters, except /verbose, are ignored /config - VMware or MSVS config file. Required when performing conversion /output - Output directory where converted XVA files will be placed The "/output" parameter is the path to a directory where the converted files will be placed. If the option is not specified, then the current directory is used. If option is specified, then the path can either already exist, or if it does not exist, it will be created (including any directories in the path that do not already exist). It is strongly advised that a new directory be specified; the resulting directory will then serve as a self-contained virtual appliance. 4.1 CONVERSION ============== For both VMware and Microsoft VMs, the registry of the VMs needs to be modified before they can be converted to XVA format and imported onto XenServer. The registry modifications are: i) Add the IOEMU emulated PCI device to the Critical Devices Database. The emulated PCI device is used by the XenSource Windows PV drivers. ii) Add "primary_ide_channel" to the Critical Devices Database. IOEMU only emulates IDE disks, and not SCSI disks. If a VM has been configured with SCSI disks, it may not contain a primary_ide_channel entry in the Critical Devices Database. Absence of this registry entry will cause converted Windows VM to not boot up when switched to using an IDE disk. VMware VMs: =========== To convert VMware VMs, the V2V tool utilizes a device driver called v2xvadrv.sys that maps the .vmdk files comprising a VMware virtual disk to a Windows virtual device as writable. The mounted VMware virtual disk can then modified as needed. The tool installs the device driver and starts the driver service. It mounts the .vmdk file(s) comprising the VMware virtual disk, and modifies the %windir%\system32\config\System registry file from the VMware virtual disk "offline" as noted above. Once the registry has been updated offline, the VMware virtual disk(s) are converted to XVA format. After converting the VMware virtual disk(s), they are unmounted from the virtual device, and the device driver is uninstalled. The following image types are supported: i) VMware 4.x Monolithic flat ii) VMware 4.x Split flat iii) VMware 4.x Monolithic sparse iv) VMware 4.x Split sparse v) ESX vmfs and vmfssparse In addition, VMware 5.x, 2.x and 3.x virtual disks should be supported, but have not been tested. NOTE: Snapshots should be removed before converting the VMware VM. Example commands: i) %> v2xva.exe /config:"D:\VMware\Windows XP\WindowsXP.vmx" ii) %> v2xva.exe /config:"D:\VMware\Windows XP\WindowsXP.vmx" /output:"E:\XE\Windows XP" iii) %> v2xva.exe /verbose:LOW /config:"D:\VMware\Windows XP\WindowsXP.vmx" /output:"E:\XE\Windows XP\" iv) %> v2xva.exe /verbose:loud /config:"D:\VMware\Windows XP\WindowsXP.vmx" Microsoft Virtual Server VMs: ============================= To convert MSVS VMs, an administrator needs to prepare the MSVS guest virtual machine for registry modification. i) Use the vhdmount utility to mount the disk (.vhd) that contains the boot partition. ii) Invoke v2xva.exe with the /vhdwindir option. This option should indicate the absolute path to the Windows directory of the MSVS VM. iii) Unmount the disk containing the boot partition. iv) Invoke v2xva.exe with the /config option to perform the conversion to XVA format. Types of images supported (Microsoft Virtual Server and Virtual PC) i) Fixed hard disk images ii) Dynamic hard disk images NOTE: Differencing hard disk images are not currently supported for conversion. Example commands: i) %> vhdmount.exe /m "D:\MSVirtualServer\Windows Server 2003\WindowsDisk-1.vhd" F %> v2xva.exe /verbose:less /vhdwindir:"F:\Windows\" %> vhdmount.exe /u "D:\MSVirtualServer\Windows Server 2003\WindowsDisk-1.vhd" %> v2xva.exe /verbose:loud /config:"D:\MSVirtualServer\Windows Server 2003\Windows.vmc" /output:"E:\XE\Windows Server 2003" ii) %> vhdmount.exe /m "D:\MSVirtualServer\Windows Server 2003\WindowsDisk-1.vhd" %> diskmgmt.msc <-- Assign driver letter to paritions %> v2xva.exe /vhdwindir:"G:\Windows" %> vhdmount.exe /u ALL %> v2xva.exe /config:"D:\MSVirtualServer\Windows Server 2003\Windows.vmc" 5. CAVEATS ========== i) Virtual Machine images with a maximum of 3 virtual disks are supported. ii) The virtual machine images must have their system and boot partition on the same virtual disk. iii) Though the registry modifications should not affect the original virtual machines from booting up in their original environment (ie, VMware Server or ESX Server), administrators should make sure the tool will work as they expect it to before deploying it on production VMs. iv) The services that were originally configured in the VMs are not disabled. Upon first boot of the converted images on XenServer as an HVM guest, administrators will notice these services failing to start up. Windows will also detect default drivers for emulated devices by QEMU and Xen. Once the default drivers are installed, the Windows HVM guest OS on XenServer will require a reboot. Once rebooted, administrators should be able to install XenSource Windows Tools. 6. REFERENCES ============= - Virtual Disk Driver. Available from http://chitchat.at.infoseek.co.jp/VMware/vdk.html, Copyright (c) 2003 Ken Kato - FileDisk. Available from http://www.acc.umu.se/~bosse, published by Bo Branten - Win32 ZLib library. Available from http://www.zlib.net, Copyright (c) 1995-2005 Mark Adler - VMware Virtual Machine Disk Format (VMDK) specification. Available from http://www.VMware.com/interfaces/vmdk.html - Microsoft Virtual Hard Disk Mount (vhdmount.exe) utility Available from http://www.microsoft.com/virtualserver