In this post, I am going to tell you about how to clone your machine on Virtual Box
To understand the concept of cloning a Virtual Machine (VM) , One must know about Source O.S. and Host O.S. (O.S. – Operating System)
a) Host O.S. (iamdemo) – The Physical O.S. in which both Source O.S. (VM that you wish to clone from) and the Target O.S (VM that wish to clone to ) would be present.
b) Guest O.S. (iamtr63 & imatr64) – The Virtual Machine created using VirtualBox on Physical O.S.
c) Source guest O.S (iamtr63). – The Guest O.S. from which we clone our Machine. For an example:- We are cloning iamtr63 (Source O.S) running on iamdemo02 (Physical Host O.S.)
d) Target guest O.S. (iamtr64) – The Guest O.S. to which you are cloning form source guest O.S. . For example:- We are cloning iamtr63 (Source O.S) running on iamdemo02 (Physical Host) to iamtr64(Target O.S.) running on same physical Host iamdemo02.
High Level Steps to Clone
1. Create a clone of VDI from source guest O.S.
2. Create a Guest O.S. for target machine and use VDI created by cloneVDI command of VirtualBox
3. Change HostName
Step by step instructions to clone Guest O.S. in VIrtualBox
1) From virtualBox shutdown source VM (iamtr63) iamtr63 -> Machine –> Close -> PowerOff >> Ensure that source machine is powered off.
2) Create a directory on physical Host(iamdemo02) for the target O.S(iamtr64) -> Let suppose i want all my virtual machines inside virtualbox directory. Therefore, the command for that is >> mkdir /virtualbox/iamtr64
3) Virtual machines in my case created in vdi file format with .vdi extension so clone VDI using VBoxManage command in VirtualBox VBoxManage clonevdi (absolute path of source vdi) (absolute path of target vdi) i.e.
VboxManage clonevdi /virtualbox/iamtr63/iamtr63.vdi /virtualbox/iamtr64/iamtr64.vdi
Note: The above command will take 15-20 min depending on size of Virtual Machine
4) When the machine gets cloned it should give a message like ”Clone hard disk created in format VDI” and the UUID for that machine would be displayed.
5) After the cloning of machine we will create a virtual machine iamtr64 from virtual box console >> Machine -> New >> On create virtual Machine
a) Name- iamtr64
b) Type- Linux (O.S. that I cloned from)
c) Version- Other linux 64bit (O.S. that I cloned from)
d) Change memory to memory you need on target machine.
e) On hard drive select “Existing Virtual Hard Drive” and select the vdi file of iamtr64 from the folder (/virtualbox/iamtr64/iamtr64.vdi).
f) Click on create
6) Select the iamtr64 and start the machine from virtualBox.
7) if you still want some changes in the target machine created then right click on the target machine and click on settings to configure settings according to your requirements.
8) Finally change the hostname on target guest O.S. (as cloned VDI or disk will have hostname of source machine). In Linux machine hostname is defined in /etc/sysconfig/network