Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save jfbvm/a254f1262ae5a89c9c89e6a89e014f4d to your computer and use it in GitHub Desktop.

Select an option

Save jfbvm/a254f1262ae5a89c9c89e6a89e014f4d to your computer and use it in GitHub Desktop.

Revisions

  1. @bitroniq bitroniq revised this gist Apr 8, 2021. 1 changed file with 8 additions and 4 deletions.
    12 changes: 8 additions & 4 deletions Converting-qcow2-to-vmdk-and-vhdx.md
    Original file line number Diff line number Diff line change
    @@ -16,20 +16,24 @@
    qemu-img convert -O vdi ubuntu.qcow2 ubuntu.vdi
    ```

    ### Convert qcow2 to vmdk and make it VMware Workstation and ESXi Compatible
    ### Convert qcow2 to vmdk and make it VMware Workstation Player Compatible

    ```bash
    qemu-img convert -f qcow2 -O vmdk -o subformat=streamOptimized ubuntu.qcow2 ubuntu.vmdk
    qemu-img convert -f qcow2 -O vmdk ubuntu.qcow2 ubuntu.vmdk
    ```

    ### Convert qcow2 to vmdk and make it ESXi Compatible (doesn't work with VMware Workstation Player)

    ### Covert for ESXi 6 - Create a VMDK version 6 image (instead of version 4)
    ```bash
    qemu-img convert -f qcow2 -O vmdk -o subformat=streamOptimized ubuntu.qcow2 ubuntu.vmdk
    ```

    * https://linux.die.net/man/1/qemu-img
    ### Covert for ESXi 6 - Create a VMDK version 6 image (instead of version 4) (doesn't work with VMware Workstation Player)

    ```bash
    qemu-img convert -f qcow2 -O vmdk -o adapter_type=lsilogic,subformat=streamOptimized,compat6 ubuntu.qcow2 ubuntu.vmdk
    ```
    * https://linux.die.net/man/1/qemu-img

    ### Convert qcow2 to Microsoft Hyper-V new vhdx format

  2. @bitroniq bitroniq revised this gist Apr 2, 2021. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions Converting-qcow2-to-vmdk-and-vhdx.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,3 @@
    https://gist.github.com/bitroniq/59273e85c506175998a384d733b4e155

    ## VM images

    ## vGateway images extensions
  3. @bitroniq bitroniq revised this gist Apr 2, 2021. 1 changed file with 7 additions and 4 deletions.
    11 changes: 7 additions & 4 deletions Converting-qcow2-to-vmdk-and-vhdx.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    https://gist.github.com/bitroniq/59273e85c506175998a384d733b4e155

    ## VM images

    ## vGateway images extensions
    @@ -10,18 +12,19 @@

    ## Example commands Convert qcow2 to other formats

    ### Convert qcow2 to vmdk and make it VMware Workstation and ESXi Compatible
    ### Convert for VirtualBox (.vdi)

    ```bash
    qemu-img convert -f qcow2 -O vmdk -o subformat=streamOptimized ubuntu.qcow2 ubuntu.vmdk
    qemu-img convert -O vdi ubuntu.qcow2 ubuntu.vdi
    ```

    ### Convert for VirtualBox (.vdi)
    ### Convert qcow2 to vmdk and make it VMware Workstation and ESXi Compatible

    ```bash
    qemu-img convert -O vdi ubuntu.qcow2 ubuntu.vdi
    qemu-img convert -f qcow2 -O vmdk -o subformat=streamOptimized ubuntu.qcow2 ubuntu.vmdk
    ```


    ### Covert for ESXi 6 - Create a VMDK version 6 image (instead of version 4)

    * https://linux.die.net/man/1/qemu-img
  4. @bitroniq bitroniq revised this gist Apr 2, 2021. 1 changed file with 8 additions and 0 deletions.
    8 changes: 8 additions & 0 deletions Converting-qcow2-to-vmdk-and-vhdx.md
    Original file line number Diff line number Diff line change
    @@ -4,6 +4,7 @@

    * .qcow2 - KVM type Virtual Machines
    * .vmdk - VMware and VirtualBox and ESXi
    * .vdi - VirtualBox
    * .vhdx - Microsoft Hyper-V
    * .vhd - Azure requires fixed size

    @@ -15,6 +16,12 @@
    qemu-img convert -f qcow2 -O vmdk -o subformat=streamOptimized ubuntu.qcow2 ubuntu.vmdk
    ```

    ### Convert for VirtualBox (.vdi)

    ```bash
    qemu-img convert -O vdi ubuntu.qcow2 ubuntu.vdi
    ```

    ### Covert for ESXi 6 - Create a VMDK version 6 image (instead of version 4)

    * https://linux.die.net/man/1/qemu-img
    @@ -40,6 +47,7 @@ qemu-img convert -o subformat=fixed,force_size -O vpc MyLinuxVM.qcow2 MyLinuxVM.

    ## Example convert.sh script

    root@aws1-cm-01:~/temp# cat convert.sh

    ```bash
    #!/bin/bash
  5. @bitroniq bitroniq revised this gist Apr 2, 2021. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion Converting-qcow2-to-vmdk-and-vhdx.md
    Original file line number Diff line number Diff line change
    @@ -40,7 +40,6 @@ qemu-img convert -o subformat=fixed,force_size -O vpc MyLinuxVM.qcow2 MyLinuxVM.

    ## Example convert.sh script

    root@aws1-cm-01:~/temp# cat convert.sh

    ```bash
    #!/bin/bash
  6. @bitroniq bitroniq revised this gist Apr 2, 2021. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions Converting-qcow2-to-vmdk-and-vhdx.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,3 @@
    https://gist.github.com/bitroniq/59273e85c506175998a384d733b4e155

    ## VM images

    ## vGateway images extensions
  7. @bitroniq bitroniq revised this gist Apr 2, 2021. 1 changed file with 8 additions and 4 deletions.
    12 changes: 8 additions & 4 deletions Converting-qcow2-to-vmdk-and-vhdx.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    https://gist.github.com/bitroniq/59273e85c506175998a384d733b4e155

    ## VM images

    ## vGateway images extensions
    @@ -7,24 +9,26 @@
    * .vhdx - Microsoft Hyper-V
    * .vhd - Azure requires fixed size

    ## Example commands Convert qcow2 to vmdk and make it ESXi Compatible
    ## Example commands Convert qcow2 to other formats

    ### Convert qcow2 to vmdk and make it VMware Workstation and ESXi Compatible

    ```bash
    qemu-img convert -f qcow2 -O vmdk -o subformat=streamOptimized ubuntu.qcow2 ubuntu.vmdk
    ```

    ### For ESXi 6 - Create a VMDK version 6 image (instead of version 4)
    ### Covert for ESXi 6 - Create a VMDK version 6 image (instead of version 4)

    * https://linux.die.net/man/1/qemu-img

    ```bash
    qemu-img convert -f qcow2 -O vmdk -o adapter_type=lsilogic,subformat=streamOptimized,compat6 ubuntu.qcow2 ubuntu.vmdk
    ```

    ## Example commands Convert qcow2 to other formats
    ### Convert qcow2 to Microsoft Hyper-V new vhdx format

    ```bash
    qemu-img convert -f qcow2 -O vhdx -o subformat=dynamic ubuntu.qcow2 ubuntu.vmdk
    qemu-img convert -f qcow2 -O vhdx -o subformat=dynamic ubuntu.qcow2 ubuntu.vhdx
    ```

    ### For Azure (VHD images on Azure must have a virtual size aligned to 1 MB.)
  8. @bitroniq bitroniq revised this gist Apr 2, 2021. 1 changed file with 36 additions and 6 deletions.
    42 changes: 36 additions & 6 deletions Converting-qcow2-to-vmdk-and-vhdx.md
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,11 @@
    # Converting images with qemu-img convert

    ## VM images

    * `.qcow2` - KVM type Virtual Machines
    * `.vmdk` - VMware and VirtualBox and ESXi
    * `.vhdx` - Microsoft Hyper-V and Azure
    ## vGateway images extensions

    * .qcow2 - KVM type Virtual Machines
    * .vmdk - VMware and VirtualBox and ESXi
    * .vhdx - Microsoft Hyper-V
    * .vhd - Azure requires fixed size

    ## Example commands Convert qcow2 to vmdk and make it ESXi Compatible

    @@ -19,8 +20,37 @@ qemu-img convert -f qcow2 -O vmdk -o subformat=streamOptimized ubuntu.qcow2 ubun
    ```bash
    qemu-img convert -f qcow2 -O vmdk -o adapter_type=lsilogic,subformat=streamOptimized,compat6 ubuntu.qcow2 ubuntu.vmdk
    ```
    ## Example commands Convert qcow2 to vmdk and make it Hyper-V Compatible

    ## Example commands Convert qcow2 to other formats

    ```bash
    qemu-img convert -f qcow2 -O vhdx -o subformat=dynamic ubuntu.qcow2 ubuntu.vmdk
    ```

    ### For Azure (VHD images on Azure must have a virtual size aligned to 1 MB.)

    * https://docs.microsoft.com/en-us/azure/virtual-machines/linux/create-upload-generic#resizing-vhds

    ```bash
    # requires qemu 2.6+
    qemu-img convert -o subformat=fixed,force_size -O vpc MyLinuxVM.qcow2 MyLinuxVM.vhd
    ```

    ## Example convert.sh script

    root@aws1-cm-01:~/temp# cat convert.sh

    ```bash
    #!/bin/bash
    echo "vGateway Name: "
    read vgwname
    echo "provide link:"
    read link
    curl $link > ${vgwname}.qcow2
    echo "Converting..."
    qemu-img convert \
    -f qcow2 \
    -O vmdk \
    -o subformat=streamOptimized \
    ${vgwname}.qcow2 ${vgwname}.vmdk
    ```
  9. @bitroniq bitroniq revised this gist Mar 31, 2021. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions Converting-qcow2-to-vmdk-and-vhdx.md
    Original file line number Diff line number Diff line change
    @@ -2,9 +2,9 @@

    ## VM images

    * .qcow2 - KVM type Virtual Machines
    * .vmdk - VMware and VirtualBox and ESXi
    * .vhdx - Microsoft Hyper-V and Azure
    * `.qcow2` - KVM type Virtual Machines
    * `.vmdk` - VMware and VirtualBox and ESXi
    * `.vhdx` - Microsoft Hyper-V and Azure

    ## Example commands Convert qcow2 to vmdk and make it ESXi Compatible

  10. @bitroniq bitroniq revised this gist Mar 31, 2021. 1 changed file with 7 additions and 2 deletions.
    9 changes: 7 additions & 2 deletions Converting-qcow2-to-vmdk-and-vhdx.md
    Original file line number Diff line number Diff line change
    @@ -8,14 +8,19 @@

    ## Example commands Convert qcow2 to vmdk and make it ESXi Compatible

    ```bash
    qemu-img convert -f qcow2 -O vmdk -o subformat=streamOptimized ubuntu.qcow2 ubuntu.vmdk
    ```

    ### For ESXi 6 - Create a VMDK version 6 image (instead of version 4)

    * https://linux.die.net/man/1/qemu-img

    ```bash
    qemu-img convert -f qcow2 -O vmdk -o adapter_type=lsilogic,subformat=streamOptimized,compat6 ubuntu.qcow2 ubuntu.vmdk

    ```
    ## Example commands Convert qcow2 to vmdk and make it Hyper-V Compatible

    qemu-img convert -f qcow2 -O vhdx -o subformat=dynamic ubuntu.qcow2 ubuntu.vmdk
    ```bash
    qemu-img convert -f qcow2 -O vhdx -o subformat=dynamic ubuntu.qcow2 ubuntu.vmdk
    ```
  11. @bitroniq bitroniq renamed this gist Mar 31, 2021. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  12. @bitroniq bitroniq created this gist Mar 31, 2021.
    21 changes: 21 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    # Converting images with qemu-img convert

    ## VM images

    * .qcow2 - KVM type Virtual Machines
    * .vmdk - VMware and VirtualBox and ESXi
    * .vhdx - Microsoft Hyper-V and Azure

    ## Example commands Convert qcow2 to vmdk and make it ESXi Compatible

    qemu-img convert -f qcow2 -O vmdk -o subformat=streamOptimized ubuntu.qcow2 ubuntu.vmdk

    ### For ESXi 6 - Create a VMDK version 6 image (instead of version 4)

    * https://linux.die.net/man/1/qemu-img

    qemu-img convert -f qcow2 -O vmdk -o adapter_type=lsilogic,subformat=streamOptimized,compat6 ubuntu.qcow2 ubuntu.vmdk

    ## Example commands Convert qcow2 to vmdk and make it Hyper-V Compatible

    qemu-img convert -f qcow2 -O vhdx -o subformat=dynamic ubuntu.qcow2 ubuntu.vmdk