美文网首页
Convert OVA/VmWare to VHD for Az

Convert OVA/VmWare to VHD for Az

作者: 不明世事的运维人 | 来源:发表于2020-08-21 16:42 被阅读0次

    <header class="post-header" style="margin-bottom: 30px; color: rgb(17, 17, 17); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(253, 253, 253); text-decoration-style: initial; text-decoration-color: initial;">

    Convert OVA to VHD for Azure VM

    <time datetime="2019-08-23T15:26:25+08:00">Aug 23, 2019</time> (Updated: <time datetime="2019-08-27T13:22:39+08:00">Aug 27, 2019</time>)

    </header>

    OVA (Open Virutal Appliance) is a file format used by VMware for distributing virtual appliance in a single file. If we want to migrate a VM packaged in OVA format to Azure, we'll need to convert it to the VHD (Virtual Hard Disk) format first which is supported by Azure.

    1. Extract VMDK from OVA

    OVA format is in essence an archive format, we can use software like 7-zip to extract VMDK (Virtual Machine Disk) file(s) from it. The VMDK file is the actual file we need to convert to VHD format.

    2. Convert VMDK to VHD

    To convert VMDK to VHD, we'll need a tool offered by Microsoft called Microsoft Virtual Machine Converter (MVMC), which provides a PowerShell module to do the conversion.

    Import-Module "C:\Program Files\Microsoft Virtual Machine Converter\MvmcCmdlet.psd1"
    ConvertTo-MvmcVirtualHardDisk C:\Path\to\Your\Disk.vmdk -VhdType FixedHardDisk -VhdFormat vhd
    
    
    • Note that -VhdType FixedHardDisk is important, as only Fixed one is supported, not Dynamic.

    • Note that -VhdFormat vhd is important, otherwise the commandlet may produce vhdx file depending on your operating system, and the vhdx format is not supported by Azure.

    To get more help on the commandlet, type Get-Help ConvertTo-MvmcVirtualHardDisk.

    3. Upload VHD to Azure Storage

    To use the VHD file in Azure as a VM image, we need to upload it as a PageBlob into a blob storage container of an Azure storage account.

    Create the storage account and blob container in Portal or use CLI or PowerShell.

    Upload can be done with Azure Storage Explorer, or AzCopy, or ConvertTo-MvmcAzureVirtualHardDisk commandlet provided by MVMC. The ConvertTo-MvmcAzureVirtualHardDisk commandlet actually combines the conversion and upload steps into one call.

    Here is an example using AzCopy v10:

    azcopy cp path/to/disk.vhd "https://storageaccount.blob.core.windows.net/container?sas" --blob-type PageBlob
    
    

    Note that --blob-type PageBlob is important as only page blob is supported for use as a VM image.

    4. Create a VM Image or Disk from the Storage Blob

    With the VHD file stored in storage blob, we can create a VM image or managed disk from it depending on whether the original VM where the VHD exports from is generalized or specialized.

    • VHD exported from generalized VM can be used to create a VM Image using Portal;
    • VHD exported from specialized VM can be used to create a VM Disk using Portal.

    5. Create a VM from the VM Image or Disk

    Finally, we can create a VM from the image we just created, or attach the Disk just created as OS disk for a new VM.

    相关文章

      网友评论

          本文标题:Convert OVA/VmWare to VHD for Az

          本文链接:https://www.haomeiwen.com/subject/qptpjktx.html