Page 1 of 4

CloneVDI tool: Linux part

Posted: 16. Sep 2009, 11:30
by Sasquatch
Some users might have seen the post by Mpack in the Windows Hosts forum, some might not even open that. He created a clone tool for VDI, VMDK and VHD files with output to VDI that runs on Windows. Now, I've tested this application on Ubuntu 9.04 with Wine 1.1.29 and it ran without issues. This does NOT mean that Mpack supports Linux or Wine in any way (it may change in the future). It's just a coincidence that it works. Users who don't like the command line, or aren't skilled with it, can use this tool with Wine (see http://www.winehq.org for downloads).

The tool can be found here: CloneVDI - Discussion & Support

If you run CloneVDI through Wine, please ask here instead of his topic so the difference is clear that it doesn't run on native Windows.
This tool is NOT supported on Linux nor Wine, it just happens to run on it.
Don't complain if you break your VM with it.
Use this topic only for discussions.
Use at your own risk.

Always make sure you have a working backup of your VDI before using any tool.

Re: CloneVDI tool: Linux part

Posted: 26. Sep 2009, 20:40
by stefan.becker
Works very well on Suse 11.1 / 64 Bit / WINE-Package "wine-1.1.29".

Re: CloneVDI tool: Linux part

Posted: 16. Oct 2009, 03:12
by enrique
Great Tool! Many Thanks!
Works out of the box on Ubuntu 9.04 with Wine to convert a Microsoft VHD image (WinXP with IE6) to VDI!
:D

(I just registered in this forum for this "thank you" post! :D )

Re: CloneVDI tool: Linux part

Posted: 18. Oct 2009, 13:35
by mpack
Well, thank you too. :-)

Re: CloneVDI tool: Linux part

Posted: 11. Nov 2009, 20:20
by neyder
great! it should be a nice tool

Re: CloneVDI tool: Linux part

Posted: 13. Nov 2009, 20:22
by scotty
Super tool! Works great in Wine on openSUSE 11!

Saves me a lot of time when testing an OS and having Windhoos crashed!:-P

Re: CloneVDI tool: Linux part

Posted: 28. Nov 2009, 00:46
by Plisgyn
A great Tool. I copied the vdi file I wanted to increase the partition size on into my virtualbox shared folder and then running CloneVDI on virtualbox XP I cloned the vdi and increased its size from 10gb to 30gb. Then running virtualbox gparted ( using iso ) I expanded the
partition from 10gb to 30gb. The cloned XP vdi now at 30gb worked a treat no problems at all.

Re: CloneVDI tool: Linux part

Posted: 29. Nov 2009, 23:08
by mpack
Hi Plisgyn - by coincidence I came across your blog on Friday, where you describe what you did. I'm glad it worked for you!

Your method is perfectly valid, I was however curious why you didn't use Wine, as that would have avoided the extra copying step (i.e. copying the VDI to a shared folder)?

Re: CloneVDI tool: Linux part

Posted: 29. Nov 2009, 23:49
by Sasquatch
I think he used a Windows VM to rule out any possible issues with Wine, even though there haven't been any reports on that. I made it into a warning that it might not work, because you don't support Wine. Just being on the safe side of things. Would still be a tricky thing if you have only one Windows VM :P.

Re: CloneVDI tool: Linux part

Posted: 30. Nov 2009, 12:16
by mpack
Sasquatch wrote:Would still be a tricky thing if you have only one Windows VM :P.
Nah, the way he described it in his blog it still works :-)

He uses the host OS (from memory, Mandriva?) to copy the VDI into the shared folder first. If he starts with only one Windows VM then he now has a copy of its VDI, which of course he can't register with VBox because of the UUID problem. He then runs CloneVDI from inside the VM, getting it to clone the copy in the shared folder - enlarging the drive and presumably changing the UUID. Now he has a valid clone, ready to be registered in VBox.

As I mentioned before, this method has an additional copying step (a problem if it's a big VDI and/or disk space is low), but on the other hand it is guaranteed to work provided you have disk space, a working Windows VM and working shared folders. It would work, for example, if there were reasons why you can't or don't want to use Wine. The only possible objection is that this is purely a technique for enlarging and/or optimizing the VDI. If all you want is a simple clone, and you already have a VDI copy made by the host OS, then simply using "VBoxManage internalcommands sethduuid" would be faster than using CloneVDI from inside a VM.

Re: CloneVDI tool: Linux part

Posted: 28. Nov 2011, 04:17
by mgogala
I maybe missing something, but there is another such tool, quite native to Linux. It's called "cp". It can clone any virtual disk to another location.

Re: CloneVDI tool: Linux part

Posted: 28. Nov 2011, 17:08
by mpack
How would one go about copying the partition map / swap partition / boot sectors etc using cp? Or filesystem metadata? Or data from folders belonging to other users?

That aside, if you find it convenient to manually create a second drive, mount it in a VM, partition it, format the partitions, and then copy all the files using cp - taking maybe ten times as long to do what for CloneVDI is quick and simple task - then good luck to you! :)

Re: CloneVDI tool: Linux part

Posted: 3. Jan 2012, 10:49
by Rat
Yep, until I found CloneVDI, I had to Defrag, Zero-fill, Compact and then Resize every single time I wanted to tidy up a virtual disk. This took about 1.5 hrs. CloneVDI takes < 5 mins!

Re: CloneVDI tool: Linux part

Posted: 12. Aug 2012, 16:39
by paddler
CloneVDI worked fabulously for me, except that there's still an entry in my .vbox and .vbox-prev files for the old .vdi uuid. These files state, that they should not be edited directly. If I remove the old .vdi from the vm folder, I get an error message on startup of the vm, although on clearing the message, the vm will start and run fine. I'm unsure reading the vboxmanage pages, which command I should use to remove the old uuid entry, to avoid future error messages. A little leery of ruining my vm.

Here are the lines in the .vbox and .vbox-prev files (with names and numbers x'd out):

Code: Select all

<VirtualBox xmlns="http://www.innotek.de/VirtualBox-settings" version="1.12-linux">
  <Machine uuid="{a-b-c-d}" name="xp" OSType="WindowsXP" snapshotFolder="Snapshots" lastStateChange="2012-08-12T14:09:37Z">
    <MediaRegistry>
      <HardDisks>
        <HardDisk uuid="{1-1-1-1-1}" location="xp.vdi" format="VDI" type="Normal"/>
        <HardDisk uuid="{2-2-2-2-2}" location="xp_new.vdi" format="VDI" type="Normal"/>
In the above entry, I want to remove the entry with the 1-1-1-1-1 uuid. Many thanks!

Re: CloneVDI tool: Linux part

Posted: 13. Aug 2012, 10:50
by mpack
Just go into File | Virtual Media Registry, select the media and "Release" it. This will disconnect it from the VMs controller. "Remove" will unregister the media - you'll be asked if you want to do a physical delete.

Be careful if you have used snapshots. If that is the case then mount the clone in a new VM, not the original: leave the old snapshot structure in place (for a while anyway) in case you need to return to it.