Convert and Import VM Virtual Disk

This entry is part of Mastering Sun xVM VirtualBox


1. a) Use Virtual Disk in VMDK format directly in VirtualBox

Just point to VMDK file in VirtualBox Virtual Disk Manager and you are done

1. b) Convert VMware VMDK to VirtualBox native VDI format

1. Convert 2Gb sparse into monolithic sparse format using OVF tools

Convert it first to OVF and after back into vmdk, don't select "flat or sparse", OVF tool will by default create one sparse VMDK file.

head -n 20 "Solaris 10 u5 64-bit Console-1f-0.vmdk"

# Disk DescriptorFile
version=1
CID=04f9d350
parentCID=ffffffff
createType="monolithicSparse"

# Extent description
RW 31457280 SPARSE "Solaris 10 u5 64-bit Console-1f-0.vmdk"

# The Disk Data Base
#DDB

ddb.virtualHWVersion = "4"
ddb.uuid.modification = "5a62188a-8088-4ded-ba7a-2dda89bf8cfb"
ddb.toolsVersion = "0"
ddb.geometry.biosSectors = "63"
ddb.uuid.parent = "00000000-0000-0000-0000-000000000000"
ddb.adapterType = "ide"

2. Convert VMDK monolithic sparse format into VDI using qemu-img (with VDI support) on Linux

I try to use conversion procedure for which you don't need to have twice disk space as is MAX disk size defined in VMDK file as it is used in procedures using RAW (unpacked) disk format.

In case of VMDK sized 1GB with MAX 15GB file RAW procedure will need minimum about 31GB:

1GB VMDK MF sparse , 15GB VMDK RAW, 15GB VDI VBox converdd, 1GB VDI VBOX compact

I will use on Linux HOST qemu-img tool with native VDI support and I will need only min 2x, max 4x size of actual virtual disk size:

1GB VMDK MF sparse, 1GB OVF , 1GB VMDK 1F sparse, 1GB VDI sparse

Compile qemu-imp tools with VDI support patch, there is an old patch from 2006, but recently pn 18 Jul 2008 Filip Navara post updated patch {Qemu-devel} Re: Updated VDI disk image support patch as qemu-vdi.zip

Download and unpack qemu 0.9.1 sources, patch it and compile qemu-img tool

 wget http://bellard.org/qemu/qemu-0.9.1.tar.gz

 gtar xzvf qemu-0.9.1.tar.gz

 patch -p0 <qemu-vdi.diff 

 ./configure

 make qemu-img

 strip qemu-img

 cp qemu-img /usr/local/bin/qemu-img-vdi

Check then VDI support is build in new qemu-img

 qemu-img | grep "Supported format"

 Supported format: parallels qcow2 vvfat vpc bochs dmg cloop vmdk qcow cow host_device raw

 qemu-img-vdi | grep "Supported format"

 Supported format: VDI parallels qcow2 vvfat vpc bochs dmg cloop vmdk qcow cow host_device raw

Now you can convert single file VMDK into VirtualBox native VDI format.

  /usr/local/bin/qemu-img-vdi convert "Solaris 10 u5 64-bit Console-1f-0.vmdk"  -O VDI "Solaris 10 u5 64-bit Console.vdi"

(VMDK) image open: flags=0x2 filename=Solaris 10 u5 64-bit Console-1f-0.vmdk
block-vdi.c:1362block-vdi.c:1377block-vdi.c:1401block-vdi.c:1432vdiCreateImage: done, filename="Solaris 10 u5 64-bit Console.vdi", rc=0

Now you can register in VirtualBox Virtual Disk Manager newly created .vdi file.

Comments:

[Trackback] Even though VMware Server was working fine with Ubuntu 10.04 (apart from random lockups with backtrace in sight to debug with), I was kinda unhappy with all the hoops one has to go through just to get a virtual machine going. The kernel modules might b...

Posted by s9y testdrive on June 06, 2010 at 11:57 AM PDT #

No longer works this way. :(

Posted by guest on March 01, 2011 at 10:51 AM PST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Hands-on experience with Virtualization

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today