Está en la página 1de 47

CLONING A VIRTUAL MACHINE IN "ORACLE VM VIRTUALBOX"

HIGH-LEVEL EXECUTIVE SUMMARY:


In "Oracle VM VirtualBox", you cannot copy a virtual machine directly. In "Oracle VM VirtualBox", you cannot copy a virtual hard drive directly. (If you use "My Computer" or "Window Explorer" to copy a virtual machine or a .vdi virtual hard drive, the "Oracle VM VirtualBox" will refuse to let you use the newly-created virtual machine or newly-created virtual hard drive.) Instead, you have to use a command line utility called "vboxmanage" clone a virtual hard drive. Then you create a new virtual machine and attach it to the cloned virtual hard drive. In "Oracle VM VirtualBox", the export/import feature can be used to move a virtual machine from one computer to another, including moves of virtual machines from a "Windows" host computer to a "Mac" host computer and vice versa.

TECHNICAL DETAILS:
When you follow the procedure to clone a virtual machine, the new virtual machine that you create will have a new, unique "UUID.BIOS" (= "machine entry UUID" = "computer UUID") and the virtual hard drive of the new virtual machine will have a new, unique "harddrive UUID". In "Oracle VM VirtualBox", all "machine entry UUID"s and "harddisk UUID"s (for all of the virtual machines) are listed in the VirtualBox.xml file in the .VirtualBox folder in your Windows profile folder.

SOME GREAT ADVICE FROM OTHERS


See http://srackham.wordpress.com/cloning-and-copying-virtualbox-virtual-machines/ and http://www.sysprobs.com/clone-virtual-machine-sun-virtualbox-simple-steps and http://geekozoid.blogspot.com/2009/05/how-to-duplicate-clone-virtualmachine.html and http://www.modhul.com/2009/06/17/how-to-clone-or-copy-a-virtualbox-virtualdisk/ and http://lukehayler.com/2011/01/cloning-virtualbox-virtual-disk-images-vdi-files/ and http://www.keithohudson.com/?p=385 and http://www.my-guides.net/en/guides/general-software/155-how-to-copy-andtransfer-or-backup-a-virtualbox-virtual-machine-vdi and http://www.oracledistilled.com/virtualbox/cloning-a-virtualbox-vm/ and http://joshuahoover.com/2010/04/01/cloning-virtualbox-images/

STEP-BY-STEP EXAMPLE:

It is usually not a good idea to use "Windows Explorer" or "My Computer" to copy an existing .vdi "virtual hard drive", since the resulting hard drive file will have the same "harddrive UUID" as the original source .vdi "virtual hard drive". Instead, you can copy the existing .vdi "virtual hard drive" using the "vboxmanage clonehd" command at the "command prompt":

Syntax: vboxmanage clonehd <full path name of source .vdi virtual hard disk file> <at least one space> <full path name of new target .vdi virtual hard disk file>

For example: Type cmd into the search or run box of the "Windows" start menu. If you are running "Windows 7" in the host computer, use the right mouse button to click on "cmd" in the left-most side of the "Start menu"; then click on "Run as administrator" in the pop-up context menu. If you are running "Windows XP" or "Windows Vista" in the host computer, press once on the Enter key of the keyboard. A command prompt Window will be displayed:

cd "Program Files" <Enter>

cd Oracle

cd virtualbox

You should now be at C:\Program Files\Oracle\VirtualBox\ Now run the "vboxmanage clonehd" command.

For example:

vboxmanage clonehd "l:\Users\testuser\.VirtualBox\HardDisks\Windows XP Professional.vdi" "l:\Users\testuser\.VirtualBox\HardDisks\Windows XP Professional-copy02.vdi" vboxmanage clonehd "l:\Users\testuser\.VirtualBox\HardDisks\Windows XP Professional.vdi" "L:\Users\testuser\.VirtualBox\HardDisks\Windows XP Professional-copy01.vdi"

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% Clone hard disk created in format 'VDI'. UUID: 210f5b3f-f04f-4d03-a84d079a3e2d4 441 The newly created .vdi "virtual hard drive" will have a new, unique UUID.

Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\testuser>dir

Volume in drive C is HP-ST3750528AS Volume Serial Number is 669A-6BF4 Directory of C:\Users\testuser 03/26/2011 06:05 PM <DIR> . 03/26/2011 06:05 PM <DIR> .. 04/01/2011 10:46 AM <DIR> .VirtualBox 01/28/2011 07:47 PM <DIR> AppData 03/03/2011 09:41 PM <DIR> Contacts 04/01/2011 01:40 AM <DIR> Desktop 03/25/2011 09:13 AM <DIR> Documents 04/01/2011 12:30 AM <DIR> Downloads 03/03/2011 09:41 PM <DIR> Favorites 02/15/2011 08:54 AM 72,080 g2mdlhlpx.exe 03/03/2011 09:41 PM <DIR> Links 03/03/2011 09:41 PM <DIR> Music 03/29/2011 10:49 PM <DIR> Pictures 03/03/2011 09:41 PM <DIR> Saved Games 03/03/2011 09:41 PM <DIR> Searches 03/03/2011 09:41 PM <DIR> Videos 04/01/2011 12:10 AM <DIR> Virtual Machines 1 File(s) 72,080 bytes 16 Dir(s) 197,250,412,544 bytes free C:\Users\testuser>l: L:\>cd users L:\Users>dir Volume in drive L is L_WCAWZ0043341 Volume Serial Number is 20BE-DE9B Directory of L:\Users 03/29/2011 12:39 AM <DIR> . 03/29/2011 12:39 AM <DIR> .. 03/29/2011 04:41 AM <DIR> testuser 0 File(s) 0 bytes 3 Dir(s) 1,349,184,933,888 bytes free L:\Users>dir Volume in drive L is L_WCAWZ0043341 Volume Serial Number is 20BE-DE9B Directory of L:\Users 03/29/2011 12:39 AM 03/29/2011 12:39 AM 03/29/2011 04:41 AM <DIR> <DIR> <DIR> . .. testuser

0 File(s) 0 bytes 3 Dir(s) 1,349,184,933,888 bytes free L:\Users>cd testuser L:\Users\testuser>dir Volume in drive L is L_WCAWZ0043341 Volume Serial Number is 20BE-DE9B Directory of L:\Users\testuser 03/29/2011 04:41 AM <DIR> . 03/29/2011 04:41 AM <DIR> .. 03/29/2011 02:35 AM <DIR> .VirtualBox 03/29/2011 02:36 AM <DIR> Documents 03/29/2011 02:43 PM <DIR> VirtualBox VMs 0 File(s) 0 bytes 5 Dir(s) 1,349,184,933,888 bytes free L:\Users\testuser>cd .virtualbox L:\Users\testuser\.VirtualBox>dir Volume in drive L is L_WCAWZ0043341 Volume Serial Number is 20BE-DE9B Directory of L:\Users\testuser\.VirtualBox 03/29/2011 02:35 AM <DIR> . 03/29/2011 02:35 AM <DIR> .. 03/29/2011 02:24 PM <DIR> HardDisks 03/29/2011 02:35 AM <DIR> Machines 09/06/2010 12:48 AM 8,308 VirtualBox.xml 09/06/2010 12:48 AM 8,308 VirtualBox.xml-prev 2 File(s) 16,616 bytes 4 Dir(s) 1,349,184,933,888 bytes free L:\Users\testuser\.VirtualBox>cd HardDisks L:\Users\testuser\.VirtualBox\HardDisks>dir Volume in drive L is L_WCAWZ0043341 Volume Serial Number is 20BE-DE9B Directory of L:\Users\testuser\.VirtualBox\HardDisks 03/29/2011 03/29/2011 03/27/2011 09/06/2010 03/29/2011 08/26/2010 02:24 PM <DIR> . 02:24 PM <DIR> .. 09:57 PM 15,663,362,560 Apple Macintosh OSX.vdi 08:06 AM 5,754,618,368 BackTrack Linux.vdi 02:35 AM <DIR> EmpireEFI 12:36 AM 67,479,577,088 m8307cC.vdi

03/26/2011 11:48 PM 2,790,344,192 Ubuntu 10.04 32-bit.vdi 09/06/2010 08:08 AM 3,388,117,504 Ubuntu 10.04 64-bit.vdi 03/26/2011 07:15 PM 2,063,073,280 Windows 2000 Pro.vmdk 09/06/2010 08:10 AM 26,673,152 Windows 3.11-vm1.vmdk 03/30/2011 02:36 AM 13,469,007,872 Windows 7 Enterprise Trial 64-bit.vdi 03/29/2011 03:53 PM 12,184,535,552 Windows 7 Home Premium 32-bit.vdi 03/26/2011 06:24 PM 12,939,632,128 Windows 7 Home Premium 64-bit.vdi 09/06/2010 08:12 AM 217,251,840 Windows 98 Second Edition.vmdk 03/27/2011 01:19 AM 575,537,152 Windows Millenium Edition.vmdk 03/27/2011 01:23 AM 124,977,152 Windows NT 4.vmdk 03/27/2011 02:44 AM 34,668,184,064 Windows Vista Business--vm1.vdi 03/20/2011 05:46 PM 4,930,609,664 Windows XP Home 32-bit.vdi 08/30/2010 04:21 PM 4,710,396,928 Windows XP Pro testVM22.vdi 03/31/2011 12:51 AM 15,775,226,368 Windows XP Professional--vm2.vdi 09/06/2010 08:18 AM 13,286,955,520 Windows XP Professional.vdi 18 File(s) 210,048,080,384 bytes 3 Dir(s) 1,349,184,933,888 bytes free L:\Users\testuser\.VirtualBox\HardDisks>dir Volume in drive L is L_WCAWZ0043341 Volume Serial Number is 20BE-DE9B Directory of L:\Users\testuser\.VirtualBox\HardDisks 03/29/2011 02:24 PM <DIR> . 03/29/2011 02:24 PM <DIR> .. 03/27/2011 09:57 PM 15,663,362,560 Apple Macintosh OSX.vdi 09/06/2010 08:06 AM 5,754,618,368 BackTrack Linux.vdi 03/29/2011 02:35 AM <DIR> EmpireEFI 08/26/2010 12:36 AM 67,479,577,088 m8307cC.vdi 03/26/2011 11:48 PM 2,790,344,192 Ubuntu 10.04 32-bit.vdi 09/06/2010 08:08 AM 3,388,117,504 Ubuntu 10.04 64-bit.vdi 03/26/2011 07:15 PM 2,063,073,280 Windows 2000 Pro.vmdk 09/06/2010 08:10 AM 26,673,152 Windows 3.11-vm1.vmdk 03/30/2011 02:36 AM 13,469,007,872 Windows 7 Enterprise Trial 64-bit.vdi 03/29/2011 03:53 PM 12,184,535,552 Windows 7 Home Premium 32-bit.vdi 03/26/2011 06:24 PM 12,939,632,128 Windows 7 Home Premium 64-bit.vdi 09/06/2010 08:12 AM 217,251,840 Windows 98 Second Edition.vmdk 03/27/2011 01:19 AM 575,537,152 Windows Millenium Edition.vmdk 03/27/2011 01:23 AM 124,977,152 Windows NT 4.vmdk 03/27/2011 02:44 AM 34,668,184,064 Windows Vista Business--vm1.vdi 03/20/2011 05:46 PM 4,930,609,664 Windows XP Home 32-bit.vdi 08/30/2010 04:21 PM 4,710,396,928 Windows XP Pro testVM22.vdi 03/31/2011 12:51 AM 15,775,226,368 Windows XP Professional--vm2.vdi 09/06/2010 08:18 AM 13,286,955,520 Windows XP Professional.vdi 18 File(s) 210,048,080,384 bytes 3 Dir(s) 1,349,184,933,888 bytes free L:\Users\testuser\.VirtualBox\HardDisks>

VBoxManage modifyhd <uuid>|<filename> [--type normal|writethrough|immutable|shareable| readonly|multiattach] [--autoreset on|off] [--compact] [--resize <megabytes>|--resizebyte <bytes>] VBoxManage clonehd <uuid>|<filename> <outputfile> [--format VDI|VMDK|VHD|RAW|<other>] [--variant Standard,Fixed,Split2G,Stream,ESX] [--existing] VBoxManage convertfromraw <filename> <outputfile> [--format VDI|VMDK|VHD] [--variant Standard,Fixed,Split2G,Stream,ESX] VBoxManage getextradata global|<uuid>|<name> <key>|enumerate VBoxManage setextradata global|<uuid>|<name> <key> [<value>] (no value deletes key)

VBoxManage setproperty machinefolder default|<folder> | vrdeauthlibrary default|<library> | websrvauthlibrary default|null|<library> | vrdeextpack null|<library> | loghistorycount <value> VBoxManage usbfilter add <index,0-N> --target <uuid>|<name>|global --name <string> --action ignore|hold (global filters only) [--active yes|no] (yes) [--vendorid <XXXX>] (null) [--productid <XXXX>] (null) [--revision <IIFF>] (null) [--manufacturer <string>] (null) [--product <string>] (null) [--remote yes|no] (null, VM filters only) [--serialnumber <string>] (null) [--maskedinterfaces <XXXXXXXX>] VBoxManage usbfilter modify <index,0-N> --target <uuid>|<name>|global [--name <string>] [--action ignore|hold] (global filters only) [--active yes|no] [--vendorid <XXXX>|""] [--productid <XXXX>|""] [--revision <IIFF>|""] [--manufacturer <string>|""] [--product <string>|""] [--remote yes|no] (null, VM filters only) [--serialnumber <string>|""] [--maskedinterfaces <XXXXXXXX>] VBoxManage usbfilter remove <index,0-N> --target <uuid>|<name>|global VBoxManage sharedfolder add <vmname>|<uuid> --name <name> --hostpath <hostpath> [--transient] [--readonly] [--automount] VBoxManage sharedfolder remove <vmname>|<uuid> --name <name> [--transient] VBoxManage guestproperty get <vmname>|<uuid> <property> [--verbose] VBoxManage guestproperty set <vmname>|<uuid> <property> [<value> [--flags <flags>]]

VBoxManage guestproperty enumerate <vmname>|<uuid> [--patterns <patterns>] VBoxManage guestproperty wait <vmname>|<uuid> <patterns> [--timeout <msec>] [--fail-on-timeout] VBoxManage guestcontrol exec[ute] <vmname>|<uuid> <path to program> --username <name> --password <password> [--arguments "<arguments>"] [--environment "<NAME>=<VALUE> [<NAME>=<VALUE>]"] [--flags <flags>] [--timeout <msec>] [--verbose] [--wait-for exit,stdout,stderr||] copyto|cp <vmname>|<uuid> <source on host> <destination on guest> --username <name> --password <password> [--dryrun] [--follow] [--recursive] [--verbose] createdir[ectory]|mkdir|md <vmname>|<uuid> <directory to create on guest> --username <name> --password <password> [--parents] [--mode <mode>] [--verbose] updateadditions <vmname>|<uuid> [--source <guest additions .ISO>] [--verbose] VBoxManage debugvm <uuid>|<name> dumpguestcore --filename <name> | info <item> [args] | injectnmi | osdetect | osinfo | getregisters [--cpu <id>] <reg>|all ... | setregisters [--cpu <id>] <reg>=<value> ... | statistics [--reset] [--pattern <pattern>] [--descriptions] VBoxManage metrics list [*|host|<vmname> [<metric_list>]] (comma-separated)

VBoxManage metrics setup [--period <seconds>] (default: 1) [--samples <count>] (default: 1) [--list] [*|host|<vmname> [<metric_list>]] VBoxManage metrics query [*|host|<vmname> [<metric_list>]]

VBoxManage metrics enable [--list] [*|host|<vmname> [<metric_list>]] VBoxManage metrics disable [--list] [*|host|<vmname> [<metric_list>]] VBoxManage metrics collect [--period <seconds>] (default: 1) [--samples <count>] (default: 1) [--list] [--detach] [*|host|<vmname> [<metric_list>]] VBoxManage hostonlyif ipconfig <name> [--dhcp | --ip<ipv4> [--netmask<ipv4> (def: 255.255.255.0)] | --ipv6<ipv6> [--netmasklengthv6<length> (def: 64)]] create | remove <name> VBoxManage dhcpserver add|modify --netname <network_name> | --ifname <hostonly_if_name> [--ip <ip_address> --netmask <network_mask> --lowerip <lower_ip> --upperip <upper_ip>] [--enable | --disable] VBoxManage dhcpserver remove --netname <network_name> | --ifname <hostonly_if_name> VBoxManage extpack install <tarball> | uninstall [--force] <name> | cleanup

C:\Program Files\Oracle\VirtualBox>vboxmanage clonehd "l:\Users\testuser\.Virtua lBox\HardDisks\Windows XP Professional.vdi" "L:\Users\testuser\.VirtualBox\HardD isks\Windows XP Professional-copy01.vdi" 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% Clone hard disk created in format 'VDI'. UUID: 210f5b3f-f04f-4d03-a84d-079a3e2d4 441 C:\Program Files\Oracle\VirtualBox>

CLONING A VIRTUAL MACHINE

IN "ORACLE VM VIRTUALBOX"
After you use the above procedure to clone a .vdi "virtual hard drive" file, you can use the steps that follow to create a new virtual machine. This new virtual machine will be very similar to the original virtual machine. It will have the same operating system as the original virtual machine. If it is running "Windows", it will have the same "SID" or "Security Identifier" as the original "Windows" virtual machine. This is only a possible problem if the new virtual machine is part of a "Windows Server" "domain". If the new virtual machine is part of a "Windows" "Workgroup", having two or more virtual machines with the same "SID" will not be a problem.

Start the "Oracle VM VirtualBox" program. The "Oracle VM VirtualBox Manager" will be displayed:

Click on the "New" button that is near the upper left-hand corner of the "Oracle VM VirtualBox Manager". A "New Virtual Machine Wizard" box will be displayed. Click on its "Next" button:

A "VM Name and OS Type" box will be displayed:

Type in an appropriate name for the new virtual machine: In this example, we typed in Windows XP Professional-copy01 Then click on the "Next" button:

A "Memory" box will be displayed:

Adjust the amount of memory for the new virtual machine: The amount of memory should be less than half the amount of memory in the host computer. Reduce the amount of memory to an appropriate amount if you plan on running more than one virtual machine at the same time. In our example, we set the amount of memory to 3.245 Gigabytes. Click on the "Next" button:

* A "Virtual Hard Disk" box will be displayed:

* Select the "Use existing hard disk" option. Then click on the little hard drive icon to the right of the box that will contain the name of the virtual hard drive:

* A "Choose a virtual hard disk file" box will be displayed:

* Navigate to the location of the new .vdi "virtual disk" file that was created in the earlier steps in this procedure:

* Click on thenew .vdi "virtual disk" file that was created in the earlier steps in this procedure. Then click on the "Open" button:

* Click on the "Next" button of the "Virtual Hard Disk" box:

* A "Summary" box will be displayed. Click on its "Finish" button:

* In should now be back at the "Oracle VM VirtualBox Manager" window:

* The newly-created virtual machine will be highlighted. Click on the "Start" button that is near the upper left-hand corner of the "Oracle VM VirtualBox Manager":

The newly-created virtual machine should be a "spitting image" of the original virtual machine:

The newly-created virtual machine will have a unique "UUID Bios" (also known as a "motherboard UUID" or a "system UUID") a unique "harddisk UUID" for it's cloned .vdi "virtual hard drive" file and a virtual network adapter with a unique MAC address. The only similarity between the new and the original virtual machines are they both will have the same Windows "SID" or "Security Identifier" which is only an issue if one or both of the virtual machines belong to a "Windows Server" "domain".

MOVING A .VDI "VIRTUAL HARD DRIVE" FILE FROM ONE PATH LOCATION TO ANOTHER PATH LOCATION IN THE SAME COMPUTER
The "Oracle VM VirtualBox" program will not allow you to use a .vdi "virtual hard drive" file that you move from one "path location" to another "path location" in the same computer, unless you delete all mention of the file from the "VirtualBox.xml" file. The "VirtualBox.xml" file is usually located at C:\Users\<your user profile name>\.Virtualbox if you are running "Windows Vista" or "Windows 7" in your host computer. (There is a period at the left side of ".Virtualbox") The "VirtualBox.xml" file is usually located at C:\Documents and Settings\<your user profile name>\.Virtualbox if you are running "Windows XP" in your host computer.

You can edit the "VirtualBox.xml" file with any text editor program including Windows' "Notepad" or Windows "Wordpad": To start "Notepad" for most Windows computers: Use the right mouse button to click on the "VirtualBox.xml" file: A pop-up context menu will be displayed.

* Click on "Edit" in the pop-up context menu:

* If you open the VirtualBox.xml file in Windows' "Notepad", it will look like this:

If you open the VirtualBox.xml file in Windows "WordPad" by selecting "Open with.." in the pop-up context menu, it looks a bit neater like this:

Delete the full path name of the .vdi "virtual hard drive" file that you either will be moving or have already moved.

APPENDIX 1: WINDOWS ACTIVATION ISSUES


The newly-created virtual machine looks like this:

Click on the Windows "Start" button of the new virtual machine:

Use the right mouse button to click on "Computer" or "My Computer" in the rightmost side of the "Start menu":

* A pop-up context menu will be displayed. Click on "Properties" in the pop-up context menu. A "System" window will displayed:

Use the vertical scroll bar to scroll down:

* Look at the "Windows activation" section at the bottom of the "System" window. Click on "Activate Windows now".

* A "Windows Activation" box will be displayed:

Click on "Activate Windows online now":

Click on the "Close" button. Note in the "Activation" section of the "System" window that it says "Windows is activated".

USING EXPORT/ IMPORT TO MOVE A VIRTUAL MACHINE FROM ONE COMPUTER TO ANOTHER IN "ORACLE VM VIRTUALBOX"
In "Oracle VM VirtualBox", you can copy a virtual machine from one computer to another using the export/import feature. This is a feature that is not available in "VMware Player" and "Windows Virtual PC". See
http://www.virtualbox.org/manual/ch01.html#ovf

The export/import feature can be used to move a virtual machine from a "Windows" host computer to another "Windows" host computer. The export/import feature can be used to move a virtual machine from a "Mac" host computer to another "Mac" host computer. The export/import feature can be used to move a virtual machine from a "Windows" host computer to a "Mac" host computer. The export/import feature can be used to move a virtual machine from a "Mac" host computer to a "Windows" host computer.

También podría gustarte