CloneVDI tool: Linux part

Discussions related to using VirtualBox on Linux hosts.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

CloneVDI tool: Linux part

Post 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.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
stefan.becker
Volunteer
Posts: 7639
Joined: 7. Jun 2007, 21:53

Re: CloneVDI tool: Linux part

Post by stefan.becker »

Works very well on Suse 11.1 / 64 Bit / WINE-Package "wine-1.1.29".
enrique
Posts: 1
Joined: 16. Oct 2009, 03:07
Primary OS: Ubuntu other
VBox Version: OSE other
Guest OSses: Windows XP

Re: CloneVDI tool: Linux part

Post 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 )
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: CloneVDI tool: Linux part

Post by mpack »

Well, thank you too. :-)
neyder
Posts: 1
Joined: 11. Nov 2009, 20:17
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: windows, ubuntu, linux, other

Re: CloneVDI tool: Linux part

Post by neyder »

great! it should be a nice tool
scotty
Posts: 2
Joined: 13. Nov 2009, 20:11
Primary OS: openSUSE
VBox Version: OSE other
Guest OSses: Windhoos

Re: CloneVDI tool: Linux part

Post 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
Plisgyn
Posts: 7
Joined: 18. May 2007, 16:25
Location: St Austell Cornwall England

Re: CloneVDI tool: Linux part

Post 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.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: CloneVDI tool: Linux part

Post 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)?
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: CloneVDI tool: Linux part

Post 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.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: CloneVDI tool: Linux part

Post 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.
mgogala
Posts: 12
Joined: 20. Nov 2011, 23:44
Primary OS: Fedora other
VBox Version: OSE Fedora
Guest OSses: OL 6.1, Centos 6, Ubuntu 11.10

Re: CloneVDI tool: Linux part

Post 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.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: CloneVDI tool: Linux part

Post 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! :)
Rat
Posts: 6
Joined: 2. Jan 2012, 07:43
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP

Re: CloneVDI tool: Linux part

Post 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!
paddler
Posts: 20
Joined: 3. Jan 2011, 17:18
Primary OS: Ubuntu other
VBox Version: OSE other
Guest OSses: ubuntu 10.10 win xp

Re: CloneVDI tool: Linux part

Post 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!
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: CloneVDI tool: Linux part

Post 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.
Post Reply