Thursday, October 29, 2009

Clone VirtualBox hard disk image

Since I am now testing VirtualBox performance, I need to clone existing guest image for multi-testing. This mini-HOWTO will guide you though the procedure for cloning a guest storage file for a new guest, under MS Windows host.

When following the official guideline and document, using VBoxManage clonehd command for disk clone, the result image is ALWAYS not functioning. Finally I figure out that a non-documented internal command is required: VBoxManage internalcommands sethduuid.

Within this artical, I am using the following system setup:

VirtualBox: v2.1.0

Host: MS Windows Vista Home Basic

Guest: Debian Lenny

Official procedure for cloning disk image (not function on MS Windows host)

Cloning an existing disk image for VirtualBox is much more than a simple copy command: it is because VirtualBox assigns a unique identity number (UUID) to each disk image, which also stored inside the image. VirtualBox will refuse to work with two image that use the same number. You need some extra handling.

According to official document, what you need is the console command VBoxManage clonehd, e.g. (host with MS Windows):

"C:\Program Files\Sun\xVM VirtualBox\VBoxManage.exe" clonehd hda.vdi hdb.vdi

or (host with Linux):

VBoxManage clonehd hda.vdi hdb.vdi

Therefore VirtualBox will copy your disk image, assign a new UUID for it, and import to its virtual media manager. You can now use it for your new guest system.

Alternative non-documented solution

As now you understand how the vboxmanage clonehd work around, what we needed is a new-and-unique UUID for our cloned disk image. There is a non-documented internal command which target for this procedure: VBoxManage.exe internalcommands sethduuid.

So what you needed for are:

(Optional) Shutdown your target guest before disk clone.

Manually copy the existing disk image, e.g.

copy hda.vdi hdb.vdi

Set a new UUID for the cloned disk, e.g.

"C:\Program Files\Sun\xVM VirtualBox\VBoxManage.exe" internalcommands sethduuid hdb.vdi

Manually add this newly cloned disk image though VirtualBox "Virtual Media Manager".

Create a new guest profile as old system, and point the primary harddisk to your newly cloned disk image.

(Document is retrieved from Google cache http://209.85.229.132/search?q=cache:http://edin.no-ip.com/content/clone-virtualbox-disk-image-ms-windows-mini-howto )

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.