How to convert *.vmdk to *.vdi disc?

Discussions related to using VirtualBox on Windows hosts.
Post Reply
pstein
Posts: 59
Joined: 20. Nov 2008, 20:48
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: Ubuntu, CentOS

How to convert *.vmdk to *.vdi disc?

Post by pstein »

Ok, in general the VB user can use *.vmdk discs from Vmware as hard discs as well.
But is there a way to convert an existing *.vmdk into VB *.vdi format?

Peter
paul.svirin
Posts: 79
Joined: 8. Dec 2009, 00:33
Primary OS: Ubuntu 8.04
VBox Version: OSE Debian
Guest OSses: Windows

Re: How to convert *.vmdk to *.vdi disc?

Post by paul.svirin »

Paul Svirin
StarWind Software developer ( http://www.starwindsoftware.com )
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: How to convert *.vmdk to *.vdi disc?

Post by mpack »

http://forums.virtualbox.org/viewtopic.php?f=6&t=22422

@pstein: I recommend that you update your profile to mention what host and guest OS's you typically use, if you want more accurate answers to questions like yours.
pstein
Posts: 59
Joined: 20. Nov 2008, 20:48
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: Ubuntu, CentOS

Re: How to convert *.vmdk to *.vdi disc?

Post by pstein »

paul.svirin wrote:Have a look at these 2 methods: http://ubuntu-tutorials.com/2009/03/22/ ... image-vdi/.
These two methods show how to use (NOT convert) an *.vmdk hard disc.
I know how to use *.vmdks discs. I need a way to convert them to *.vdi
viewtopic.php?f=6&t=22422
Similar here: As mentioned in the thread CloneVDI is only applicable to *.VDIs. I have a *.vmdk and want to convert it to *.vdi

This is not possible with CloneVDI

So the convert question is still open

Peter
jorgensen
Posts: 583
Joined: 20. Oct 2009, 01:22
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, LinuxMint

Re: How to convert *.vmdk to *.vdi disc?

Post by jorgensen »

VBoxManage clonehd <filename> <outputfile> --format VDI
pstein
Posts: 59
Joined: 20. Nov 2008, 20:48
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: Ubuntu, CentOS

Re: How to convert *.vmdk to *.vdi disc?

Post by pstein »

jorgensen wrote:VBoxManage clonehd <filename> <outputfile> --format VDI
Ok. Thank you but it does not work. It gives here:

C:\vm\harddisks\Ubuntu>C:\vm\VirtualBox\v3.1.2\VBoxManage clonehd Ubuntu.vmdk Ubuntu.vdi --format VDI
VirtualBox Command Line Management Interface Version 3.1.2
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.
ERROR: Cannot register the hard disk 'C:\vm\harddisks\Ubuntu\Ubuntu.vmdk' with UUID {78e88a3e-4495-41d1-807e-6a1e890ad7ee} because a hard disk 'C:\vm\harddisks\Ubuntu\Ubuntu.vmdk' with UUID {78e88a3e-4495-41d1-807e-6a1e890ad7ee} already exists in the media registry ('C:\Documents and Settings\haer01\.VirtualBox\VirtualBox.xml')
Details: code E_INVALIDARG (0x80070057), component VirtualBox, interface IVirtualBox, callee IUnknown
Context: "OpenHardDisk(Bstr(szFilenameAbs), AccessMode_ReadWrite, false, Bstr(""), false, Bstr(""), srcDisk.asOutParam())" at line 628 of file VBoxManageDisk.cpp


By the way: Which of the *.vmdk's do I have to convert ? All of the following:

Ubuntu-s001.vmdk
Ubuntu-s002.vmdk
Ubuntu-s003.vmdk
Ubuntu-s004.vmdk
Ubuntu-s005.vmdk
Ubuntu-s006.vmdk
Ubuntu.vmdk

?

I guess it is sufficient to convert the main one and all depending will be converted as well.
Am I right?
Peter
jorgensen
Posts: 583
Joined: 20. Oct 2009, 01:22
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, LinuxMint

Re: How to convert *.vmdk to *.vdi disc?

Post by jorgensen »

Remove all snapshots.
Remove the vmdk from the Media Manager
Use full pathname for the source.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: How to convert *.vmdk to *.vdi disc?

Post by mpack »

pstein wrote:Similar here: As mentioned in the thread CloneVDI is only applicable to *.VDIs. I have a *.vmdk and want to convert it to *.vdi
Look more closely, and bear in mind that the tool has been updated several times since the early messages of that thread. In fact, forget the thread, just download the tool and read the current release notes.
pstein wrote:This is not possible with CloneVDI
It is very much possible, or I would not have referred you to it. In fact it is by far the easiest and fastest way to do what you need, at least on a Windows host.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: How to convert *.vmdk to *.vdi disc?

Post by mpack »

pstein wrote:I guess it is sufficient to convert the main one and all depending will be converted as well.
Yes, provided you understand which one the "the main one" is. It is usually the smallest file. In the case of your list I would expect that "ubuntu.vmdk" is the main file - and all the other files will be additional extents, not snapshots or differenced images.
pstein
Posts: 59
Joined: 20. Nov 2008, 20:48
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: Ubuntu, CentOS

Re: How to convert *.vmdk to *.vdi disc?

Post by pstein »

mpack wrote:
pstein wrote:This is not possible with CloneVDI
It is very much possible, or I would not have referred you to it. In fact it is by far the easiest and fastest way to do what you need, at least on a Windows host.

Ok, thank you. It works now :-)

However one small issue remains:

Although I checked "Compact drive while copying" I found NO shrinked result.
The hard disc takes almost the same amount of space (~ 3.4 GB !) as the original .vmdk.

Why?

Ubuntu + a small additional tools take normally at most 500 MB. So why do I need a hard disc with 3.4 GB ?

Peter
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: How to convert *.vmdk to *.vdi disc?

Post by mpack »

pstein wrote:Although I checked "Compact drive while copying" I found NO shrinked result.
Ubuntu + a small additional tools take normally at most 500 MB. So why do I need a hard disc with 3.4 GB ?
Peter
Don't you have a swap partition? That by itself usually accounts for something like 2GB.

Compacting is only possible if there is deleted space (ie. space dynamically allocated for files which have since been deleted), and the guest is using a supported filesystem (FATx, NTFS or EXTx), and the guest HD is using a supported partitioning scheme (MBR).
Post Reply