Monday, March 5, 2012

Clone a Linux Ubuntu Server VirtualBox Image

Monday, March 05, 2012 Posted by Unknown , , ,
First shutdown the Ubuntu Server which we want to clone.
sudo shutdown now
After this close the console window and select poweroff the machine.
Now rightclick on the virtualmachine that you want to clone and select clone.

Give the machine a new name in my case ubuntu01 and select the option to reinitialize the MAX address of all network cards so that you don’t have duplicate mac addresses on your virtual network in case you start both vm’s at the same time.

Select the default Full Clone. So that the original will stay in tact and we can clone again for other tests.
After the clone the new cloned virtualmachine has a new MAC address. Look it up in settings view:

Now boot up the new cloned virtualmachine ubuntu01. this takes a while because it can’t find the new ethernet device. After the server has started, login and edit the file:
sudo vi /etc/udev/rules.d/70-persistent-net.rules

Remove the first PCI device which is the old ethernet MAC address and change the device name of this line to eth0 as displayed in the image beneath:

Next change the hostname of the new clones virtual machine:
sudo vi /etc/hostname
Change ubuntu to ubuntu01 (old to new name).
Reboot the Virtual Machine:
sudo reboot now
And you have a clone of the original (which can be messed up Winking smile)