Cloning a VirtualBox Image (vdi)

Following on from my previous blog entry where I described how to install Oracle 11.2.0 on Ubuntu 10.10 in a VirtualBox I will quickly describe how we can clone this image and hence reduce the rebuild time. What I tend to do is create a backup copy of my vdi files that I can return to later and I will assume that you have one of these within this entry and it is called Ubuntu10.10-32BitOracle11g.vdi.

Copy Backup vdi

Copy your backup vdi file,Ubuntu10.10-32BitOracle11g.vdi , to the location where all your VirtualBox vdi files are stored. We shall call it Ubuntu10.10-32BitOracle11g-Copy.vdi.

Once the copy has completed open a command prompt and navigate to the directory containing the vdi file and execute the following command:

Windows:

"C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe" internalcommands sethduuid Ubuntu10.10-32BitOracle11g-Copy.vdi

This will generate a new UUID for the VirtualBox vdi file and allow you to add it to your VirtualBox instance and produce and output similar to the following:

Update uuid

Add to VirtualBox Media Manager

Now we have a copy of the vdi file we will need to add it to VirtualBox as follows:

File->Virtual Media Manager
Virtual Media Manager

Select Add
Media
Media

Now we can create a new Virtual Machine.

Create a New Virtual Machine

To use the newly added vdi we create the machine as follows with the details below:

  • Name : Copy Oracle 11g DB
  • OS : Linux
  • Version : Ubuntu
  • Base Memory : 3072
  • Use Existing Hard Disk : Ubuntu10.10-32BitOracle11g-Copy.vdi

new machine
new machine
new machine
new machine
new machine

Configuring Ubuntu

To allow both the existing and new Ubuntu images to run on the network you will need to change the hostname of the new machine. To do this we will need to start the new Machine (Copy Oracle 11g DB) and edit two file.

Edit the /etc/hostname file using the command:

sudo gedit /etc/hostname

Change the name to the new machines hostname (ubuntu-oracle-11g-copy).

Edit the /etc/hosts file using the command:

sudo gedit /etc/hosts

Change all occurrences of the original name to the name in /etc/hostname (although for an instance running 11g you may want to add the new name to the 127.0.0.1 line because the database files may contain an internal reference to the host name).

Once these changes have been done the instance will need to be rebooted for the to take effect and we now have a new copy of the original Ubuntu instance.

Auto Mount Shared Folders

If you use Shared folders within VirtualBox these can be easily auto mounted by doing the following (I assume the name of the shared folder is VirtualBoxShare).

  1. Create a local directory within Ubuntu (/VirtualBoxShare).
  2. Edit the /etc/modules file (sudo gedit /etc/modules) and add:

    vboxvfs
    vboxadd

  3. Edit the /etc/fstab file (sudo gedit /etc/fstab) and add :

    VirtualBoxShare /VirtualBoxShare vboxsf defaults 0 0

Now when we start the image the Shared Folder will be mounted.

Comments:

Post a Comment:
Comments are closed for this entry.
About

As a member of the Oracle A-Team we specialise in enabling and supporting the Oracle Fusion Middleware communities.

Search

Archives
« April 2014
MonTueWedThuFriSatSun
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today