Linux vdi to vhd

Converting and cloning virtual HDDs between VDI, VMDK and VHD

There are several disk image formats used by virtualization software; VDI for Oracle VM VirtualBox, and VMDK for VMware vSphere, to name a few. If you want to convert VirtulBox VDI image to VMware VMDK image, or vice versa, there are two command-line utilities available to use.

The first tool is VBoxManage (vboxmanage.exe on Windows), which is a command-line utility that comes with VirtualBox. If you already installed VirtualBox on your system, VBoxManage is ready for use right away without installing any other software.

The second Linux tool is qemu-img command which is part of qemu hardware virtualization package.

To use qemu-img on Ubuntu or Debian:

$ sudo apt-get install qemu-utils

To use qemu-img on CentOS, Fedora or RHEL:

Assuming that you have either of these two command-line tools available on your system, I will show how to convert between VirtualBox VDI and VMware VMDK formats, and how to import a converted standalone disk image in a VM. Before conversion, make sure to power off the VM whose disk image is being converted.

Convert VMware VMDK to VirtualBox VDI

To convert VMDK to VDI with VboxManage:

>$ VBoxManage clonehd --format VDI input.vmdk output.vdi

The output of this command will be similar to the following:

>$ /usr/bin/VBoxManage clonehd image_to_convert.vmdk converted.vdi --format VDI --variant standard --type normal 

Sun VirtualBox Command Line Management Interface Version 3.1.6
(C) 2005-2010 Sun Microsystems, Inc.
All rights reserved.

0%. 10%. 20%. 30%. 40%. 50%. 60%. 70%. 80%. 90%. 100%
Clone hard disk created in format 'VDI'. UUID: 84f005f6-bbf8-4a0e-9fe8-3b7bf0df14d5

To convert VMDK to VDI with qemu-img:

$ qemu-img convert input.vmdk -O vdi output.vdi

Import VDI disk image in VirtualBox VM

Once you create a VDI-formatted disk image from a VMDK counterpart, you can create a new VM on VirtualBox, and attach the VDI image to the VM. While creating a VM, just choose «Use an existing virtual hard drive file» option, and use the existing VDI image file.

Читайте также:  Behringer u phoria umc202hd linux

The clonehd command of VBoxManage supports the conversion between VDI, VMDK, VHD, so the three major virtualization’s hypervisors are supported (Oracle, VMware and Microsoft).

clonehd  
[--format VDI|VMDK|VHD|RAW|]
[--variant Standard,Fixed,Split2G,Stream,ESX]
[--existing]

Converting virtual HDDs between VDI, VMDK and VHD

Converting virtual HDDs between VDI, VMDK and VHD

Convert VirtualBox VDI to VMware VMDK

To convert VDI to VMDK with VboxManage:

$ VBoxManage clonehd --format VMDK input.vdi output.vmdk

To convert VDI to VMDK with qemu-img:

$ qemu-img convert input.vdi -O vmdk output.vmdk

Import VMDK disk image in VMware VM

Once you obtained a VMDK disk image from a VDI image, you can attach the standalone VMDK disk image to a VMware VM as follows.

First, create a new VM by using VM creation wizard. When asked to choose an OS installation option, choose «I will install operating system later» option, as shown in the following. That way, it will skip disk image creation.

Converting virtual HDDs between VDI, VMDK and VHD

Converting virtual HDDs between VDI, VMDK and VHD

Once.vmx file is created, edit the .vmx file to specify the existing VMDK image file as follows.

Clone VirtualBox disks VDI to duplicate a virtual machine

First you need to eelease and remove the VMware image from virtualbox’s virtual media manager if the disk is already in use by one of your virtual machines.

Copy the disk using VBoxManage:

>$ VBoxManage clonevdi disk.vdi disk_clone.vdi 

Sun VirtualBox Command Line Management Interface Version 3.1.6
(C) 2005-2010 Sun Microsystems, Inc.
All rights reserved.

0%. 10%. 20%. 30%. 40%. 50%. 60%. 70%. 80%. 90%. 100%
Clone hard disk created in format 'VDI'. UUID: 124fbdf2-4e63-44dc-abfc-cef2899eaf6f

Now add the two disks back into Virtual Media Manager, they are ready to be used in your virtual machines!

Читайте также:  Input command in linux

Download

Instructions about VBoxManager and his syntax is available, in HTML format, here:

Источник

Convert disk images to various formats using qemu-img

In this article, we would focus on how to convert disk images to various formats using command-line utility qemu-img in Ubuntu distribution. Disk images are virtual hard disks which are used with virtual machines. These disk images are used to emulate disk storage devices. Furthermore depending on virtualization used, different disk images are utilized by different applications like QEMU/KVM, VirtualBox etc.

First we would discuss how to get command-line utility qemu-img (Qemu disk image utility).

Note: Following operations would require you to have superuser privileges. In case you don’t have one, then contact your System Administrator for assistance.

Install qemu-img in Ubuntu distribution

The required package is already available in standard Ubuntu repository. Therefore, we need to first update the repository. So, issue the following in terminal –

Now, qemu-img command-line utility is packaged with qemu-utils. Hence –

sudo apt install qemu-utils

Convert RAW image to Qcow2, VDI, VMDK & VHD

I. Convert Raw image to Qcow2:

qemu-img convert -f raw image.raw -O qcow2 image.qcow2

II. Convert Raw image to VDI:

qemu-img convert -f raw image.raw -O vdi image.vdi

III. Convert Raw image to VMDK:

qemu-img convert -f raw image.raw -O vmdk image.vmdk

IV. Convert Raw image to VHD:

qemu-img convert -f raw image.raw -O vpc image.vhd

Convert Qcow2 image to RAW, VDI, VMDK & VHD

I. Convert Qcow2 image to RAW:

qemu-img convert -f qcow2 image.qcow2 -O raw image.raw

II. Convert Qcow2 image to VDI:

qemu-img convert -f qcow2 image.qcow2 -O vdi image.vdi

III. Convert Qcow2 image to VMDK:

qemu-img convert -f qcow2 image.qcow2 -O vmdk image.vmdk

IV. Convert Qcow2 image to VHD:

qemu-img convert -f qcow2 image.qcow2 -O vpc image.vhd

Convert VDI image to RAW, Qcow2, VMDK & VHD

I. Convert VDI image to RAW:

qemu-img convert -f vdi image.vdi -O raw image.raw

II. Convert VDI image to Qcow2:

qemu-img convert -f vdi image.vdi -O qcow2 image.qcow2

III. Convert VDI image to VMDK:

qemu-img convert -f vdi image.vdi -O vmdk image.vmdk

IV. Convert VDI image to VHD:

qemu-img convert -f vdi image.vdi -O vpc image.vhd

Convert VMDK image to RAW, Qcow2, VDI & VHD

I. Convert VMDK image to RAW:

qemu-img convert -f vmdk image.vmdk -O raw image.raw

II. Convert VMDK image to Qcow2:

qemu-img convert -f vmdk image.vmdk -O qcow2 image.qcow2

III. Convert VMDK image to VDI:

qemu-img convert -f vmdk image.vmdk -O vdi image.vdi

IV. Convert VMDK image to VHD:

qemu-img convert -f vmdk image.vmdk -O vpc image.vhd

Convert VHD image to RAW, Qcow2, VDI & VMDK

I. Convert VHD image to RAW:

qemu-img convert -f vpc image.vhd -O raw image.raw

II. Convert VHD image to Qcow2:

qemu-img convert -f vpc image.vhd -O qcow2 image.qcow2

III. Convert VHD image to VDI:

qemu-img convert -f vhd image.vhd -O vdi image.vdi

IV. Convert VHD image to VMDK:

qemu-img convert -f vpc image.vhd -O vmdk image.vmdk

In conclusion, we have discussed how to convert disk images to various formats using qemu-img in Ubuntu.

Читайте также:  Behringer u phoria umc202hd linux

Источник

Оцените статью
Adblock
detector