+3 votes
252 views
How to copy a VirtualBox virtual machine

in Virtualization by (552k points)
reopened | 252 views

1 Answer

+4 votes
Best answer

1. Copy a virtual machine from the VirtualBox application
2. Copy a virtual machine from CMD or Command Prompt

The use of virtual machines is one of the most practical, safe and reliable options for testing in an environment new operating systems, new applications or evaluating the behavior that a certain configuration may have before it is implemented in a productive and real environment..

There are multiple tasks that we can perform within our virtual machines and one of the most important in some cases, especially for availability issues, is to copy one or more virtual machines . This process will copy all the current configuration of the selected machine and with this it will be possible to perform more tests on that machine that we have copied without affecting the original machine.

When to copy a virtual machine
There are several methods to carry out this process which TechnoWikis will explain in detail but before we should know that to copy our virtual machine can be given two special situations that are:
  • Copy the virtual machine while it is off.
  • Copy the virtual machine while it is in its saved state.
Note
For no reason can we copy a virtual machine in VirtualBox while it is active.
VirtualBox features
VirtualBox is one of the most used virtualization utilities for its dynamism and ease of creation and administration of virtual machines, some of its most outstanding features are:
  • Possibility of creating groups of virtual machines.
  • VirtualBox is a multiplatform hypervisor Type 2, that is, it is that a VM created in a host can be executed another and, when using Open Virtualization Format (OVF), the invited VMs can be imported and exported at any time.
  • Available in 32 and 64 bit architectures.
  • Integration of the Guest additions which are a set of tools that are installed in the guest operating system in order to improve their performance and provide additional integration and communication with the host system.
  • Ability to take Snapshots which keep snapshots of the status information of the invited virtual machine and we can access that state at any time.
  • Great hardware support since VirtualBox supports guest SMP, USB devices, full ACPI support, multi-screen resolution, built-in iSCSI support and PXE network boot.

Now we will see the different options to copy our virtual machines in VirtualBox..


1. Copy a virtual machine from the VirtualBox application

Step 1

As we have mentioned, it is possible to clone or copy our virtual machine when it is off or with its saved state, when a virtual machine is active and we click on the X sign to close VirtualBox the following window will be displayed: image
Note
In case of not having VirtualBox, we can download it at the following link:
VirtualBox

Step 2

There we can select the option "Save the state of the machine" and we will see the following. There we can see the legend "Saved". image
Step 3

The cloning function will be active in one of these two states and to use it we have the following options:
  • Right click on the virtual machine and select the Clone option
  • Use the key combination:

+ O Ctrl + O

  • Go to the "Machine / Clone" menu
image
Step 4

When selecting this option, the following wizard will be displayed:

image

Step 5

There we have the following options:
  • Define the name of the machine that will be cloned or copied.
  • Define the route where it will be hosted.
  • In the field "MAC Address Policy" we have some options at the MAC address level, such as adding only the MAC address of the active network adapter, including all the MAC addresses of the available adapters or generating a new MAC address.
  • Keep the name of the virtual hard disks and the UUIDs of the hardware.
Step 6

If we click on the button "Expert mode" we can perform the following actions:
  • Define the type of cloning to be performed.
  • Define whether snapshots are added to the machine or not.

image

Step 7

If we continue with the guided mode in the next window we can only define the type of cloning to be performed:

image

Step 8

For reasons of integrity of all values ​​and parameters it is best to use the option "Cloning complete", click on the "Clone" button to execute the process:

image

Step 9

Once this process finishes we will see that the machine that we have cloned or copied will be available from the VirtualBox platform. From there we can verify that your current state has been copied, it is possible to use it for all the tasks that we consider necessary. image

2. Copy a virtual machine from CMD or Command Prompt

Step 1

The previous method is useful and practical since it is enough to click a few clicks to clone our virtual machine but we also have the opportunity to execute this process from the Windows 10 CMD console, for this we must first know the path and the name of the VDI disk (virtual hard disk) of the machine that we are going to copy:

image

Step 2

Once we define this path and name, we must access the command prompt as administrators and first use the cd command to go to the directory where the virtual machine is hosted, in this case we will execute the following:
 D: \ Virtual machines \ Windows 10 TechnoWikis 
Step 3

Once we are in the directory where the VirtualBox virtual machine is created, we will execute the following line:
"C: \ Program Files \ Oracle \ VirtualBox \ VBoxManage.exe" clonevdi "Windows 10 TechnoWikis" .vdi "Windows 10 TechnoWikis-copia" .vdi
"Windows 10 TechnoWikis" .vdi is the name of the current virtual disk and "Windows 10 TechnoWikis-copia" .vdi will be the name of the new machine to be copied: image
Step 4

We can see that the medium has been created correctly, we can access the new disk created using the dir command like this:
 dir "Windows 10 TechnoWikis-copia" .vdi 
image
Step 5

This process will copy the virtual hard disk of the original machine which we will see in the same path where the initial machine is.

image

Step 6

Now, to make use of this disk, we are going to create a new virtual machine and in the "Hard Disk" section we activate the "Use an existing virtual hard disk file" box:

image

Step 6

Click on the folder icon and go to the path where we have copied the hard drive through the terminal: image
Step 7

We click on the "Open" button and we will see that this hard drive is integrated. There we click on "Create" and continue with the normal process of creating a virtual machine in VirtualBox.

image

Using any of the mentioned methods, it will be possible to copy our virtual machines from VirtualBox and from there be able to perform additional tasks on them without being affected at any time the configuration of the original machine, this will help reduce support tasks about these machines.


by (3.5m points)
edited

Related questions

+5 votes
1 answer
asked Nov 20, 2019 in Virtualization by backtothefuture (552k points) | 425 views
+4 votes
1 answer
asked Jun 23, 2019 in Virtualization by backtothefuture (552k points) | 227 views
+5 votes
1 answer
asked Jun 28, 2023 in Virtualization by backtothefuture (552k points) | 61 views
+3 votes
1 answer
asked Sep 25, 2019 in Virtualization by backtothefuture (552k points) | 658 views
+3 votes
1 answer
asked Jun 24, 2019 in Virtualization by backtothefuture (552k points) | 220 views
Sponsored articles cost $40 per post. You can contact us via Feedback

Most popular questions within the last 30 days

10,659 questions
10,791 answers
510 comments
3 users