VirtualBox

Ticket #5637 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

VBoxManage clonehd is very slow when cloning empty VDI => fixed in SVN/3.2.6

Reported by: Donuts Owned by:
Priority: major Component: virtual disk
Version: VirtualBox 3.2.4 Keywords:
Cc: Guest type: other
Host type: other

Description

Hi,

VBoxManage is very slow when cloning an empty VDI file. For example, try this:

VBoxManage createhd --filename test.vdi --size 20480 VBoxManage clonehd test.vdi test_cloned.vdi

That maxes out my 2.1GHz Core 2 Duo for about 20 seconds. (Ubuntu 9.10 x86 host)

Change History

comment:1 Changed 4 years ago by klaus

I'm very much inclined to closing this ticket as "wontfix". Optimizing this will only work under extremely specific assumptions, and it would make the VirtualBox code unreadable. clonehd can convert between image formats and has lots of complexity already. Being able to "process" 1GB/sec isn't bad, especially as cloning empty images isn't the most common use case.

comment:2 Changed 4 years ago by Donuts

Well, it does seem extremely sub-optimal! :)

This probably doesn't only apply to completely-empty VDIs. The wasted time/inefficiency will probably apply to any VDI which has a significant amount of empty space. For example, if I create a 100GB VDI and install an OS to it, there might be 90GB free. Cloning that VDI would surely be a common use case - replicating a "master" image several times to install/use different applications on. If the same issue is present, it would take about 90 sec longer than necessary each time the VDI is cloned (on my machine).

The time wasted increases with the VDI size; cloning an empty 200GB VDI (819712 bytes) took about 190 secs. It would be more than double that on a slower machine.

What exactly is VBoxManage doing that takes so long? Is it, for each 1MB of the emulated disk, allocating 1MB RAM, clearing it, then checking the RAM is clear and writing four 0xFF bytes to the destination, then freeing the memory?

As a workaround, it's possible to simply copy the VDI file and change the copy's UUID by doing "VBoxManage internalcommands sethduuid filename.vdi". (Is that documented anywhere?)

comment:3 Changed 4 years ago by klaus

  • Priority changed from trivial to major
  • Host type changed from Linux to other
  • Version changed from VirtualBox 3.0.12 to VirtualBox 3.2.4

I'm starting to change my mind... there must be a way to boost efficiency in this situation, without resorting to the suggested hacks which don't solve other important cases which are similarly slow.

We have a confirmed report that converting from any image format (no data) to a stream optimized VMDK (used as part of the OVF export routine) is slow. I measured that converting a 1TByte image takes about 50 minutes on a slow Windows system, and it uses a lot of CPU time.

comment:4 Changed 4 years ago by aeichner

  • Status changed from new to closed
  • Resolution set to fixed
  • Summary changed from VBoxManage clonehd is very slow when cloning empty VDI to VBoxManage clonehd is very slow when cloning empty VDI => fixed in SVN/3.2.6

This is fixed now, cloning an empty 1TB image takes ~2 seconds now ;)

Note: See TracTickets for help on using tickets.

www.oracle.com
ContactPrivacy policyTerms of Use