About Me

Database and GIS Consultant.

Sunday, March 2, 2014

Clone Oracle Linux 6.3 Virtual Machine in VMware ESXi 5.5 for Oracle 11g RAC database

Objective: Clone Linux Virtual Machine in VMware ESXi 5.5 for Oracle 11g RAC database

Plan: We will copy VM1 and change its host and network configurations to create VM2.

Pre-Requisites:-

a. Already created 1st Virtual Machine and installed 64 bit Oracle Linux 6 in the VM1, click links to see the steps


b. SSH PuTTY client exe (from www.chiark.greenend.org.uk) downloaded in my laptop
 

Create a new folder for the 2nd VM's storage
   
1) Connect to ESXi host using vSphere client,  go to "configuration" tab, then go to "Storage" under "Hardware" on the left and Right Click on the "datastore1" and click "Browse Datastore":-



2) Click the root folder and click "Create a new folder" icon and give a folder name for the 2nd VM and click OK. In my example, I have given "node2.babulab".





Copy files to new folder:-

3) From the "node1.babulab" source folder, copy the .vmx and .vmdk files to "node2.babulab" destination folder



 


4) I
n node2.babulab folder, rename the file "node1.babulab.vmx" to "node2.babulab.vmx"

5) I will be using
putty to rename the vmdk (virtual disk) file, in order to connect (SSH) to ESXi host using putty, we will have to enable SSH at the ESXi host:-

In ESXi,  go to "configuration" tab, then go to "Security Profile" under Software, choose "SSH" and click "Properties":-



6) Click Options



7) Enable and start SSH as shown below (you can chose the 3rd option to start and stop manually if you are a bit more concerned about security)




8) Run "putty.exe" from my laptop and connect to the ESXi host, provide the ESXi IP address, accept the security warning and logon as root:- 






9) Change directory to node 2 and run Volume Management Tool  "vmkfstools" to rename the virtual disk (vmdk file):-

~ # cd /vmfs/volumes/datastore1/node2.babulab
/vmfs/volumes/52ff2dba-f5e66f8c-6fbc-00219b6d6d1c/node2.babulab # vmkfstools -E node1.babulab.vmdk node2.babulab.vmdk

/vmfs/volumes/52ff2dba-f5e66f8c-6fbc-00219b6d6d1c/node2.babulab # ls -l
total 20971528
-rw-------    1 root     root     21474836480 Feb 17 20:07 node2.babulab-flat.vmdk
-rw-------    1 root     root           524 Feb 17 20:46 node2.babulab.vmdk
-rw-------    1 root     root          3324 Feb 17 20:07 node2.babulab.vmx


10) After the rename, go to the new folder for node 2, choose the "vmx" file, right click and choose "Add to Inventory":-



11) Provide name for the 2nd VM 



12) Click next and finish in the next screen. Now you will see the 2nd VM created.





13) On the newly created VM, the Hard Disk is still pointing to the 1st node, so we will have to delete it and add the correct one.
Right click on the newly created 2nd VM and choose "Edit Settings":-



14) Choose Hard disk 1, and click "Remove"




15) From the same screen, click "Add"



16) Choose "Hard Disk"



17) Select "Use an existing virtual disk"



18) Browse to the "vmdk" of the 2nd VM and click OK




19) Click Next 



20) Select "SCSI (0:0)", click next



21) Review the summary and click Finish



22) Click OK at this final screen:



Now the cloned 2nd VM will have the same hostname and network info as present in 1st VM. So, we will have to change them in the 2nd VM.

23) Right click on the new (2nd) VM and chose "Edit Settings", click on each Network Adapters and note down the MAC addresses:-



24) Start the newly created VM, startup it will prompt with below screen, choose "I copied it" and click OK.



25) Once the Linux VM is booted up, login as "root" to see the existing interface configuration, we will be changing it in the next few steps:


# ifconfig
eth3      Link encap:Ethernet  HWaddr 00:0C:29:FF:AE:49 
          inet6 addr: fe80::20c:29ff:feff:ae49/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1368 (1.3 KiB)  TX bytes:1836 (1.7 KiB)

eth4      Link encap:Ethernet  HWaddr 00:0C:29:FF:AE:53 
          inet addr:192.168.1.9  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:feff:ae53/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:201 errors:0 dropped:0 overruns:0 frame:0
          TX packets:40 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:60003 (58.5 KiB)  TX bytes:5246 (5.1 KiB)

eth5      Link encap:Ethernet  HWaddr 00:0C:29:FF:AE:3F 
          inet6 addr: fe80::20c:29ff:feff:ae3f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1368 (1.3 KiB)  TX bytes:1836 (1.7 KiB)

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:16 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:960 (960.0 b)  TX bytes:960 (960.0 b)



26) Edit the "/etc/sysconfig/network" file to change the hostname as follows:-

"HOSTNAME=node2.babulab"

27) In the menu click "System" > "Preferences" > "Network Connections"


Here you will see total of 6 network interfaces (eth0, eth1, eth2, eth3, eth4 and eth5) present in the new VM 

Three (eth0, eth1, eth2) that got carried forward from old VM1 and three new (eth3, eth4, eth5) as the new VM has been assigned new MAC address by the virtual hardware.
 
Delete the old/invalid network interfaces eth0, eth1 and eth2


28) Note down the details of the remaining network interfaces (eth3, eth4 and eth5) which will be as follows:-


29) Now we need to modify the Network Interfaces (Network adapters / Interface order of VM2 should match with VM1. So eth5, eth3, eth4 to be renamed as eth0, eth1, eth2  and their corresponding methods and IPs) in the new virtual machine for the right MAC addresses:- 


Make a copy of the below file. And edit the below file to delete the entries of old invalid eth# and correct the eth# to use the right MAC address as we documented above.

# vi /etc/udev/rules.d/70-persistent-net.rules

30) Reboot node2


# init 6

 
31) Start up node1

32) Test Network connectivity between nodes and external as well, all below pinging should work:-

From node1.babulab


# ping node2.babulab
# ping node2-priv.babulab
# ping yahoo.com

 
From node2.babulab


# ping node1.babulab
# ping node1-priv.babulab

# ping yahoo.com
 
33) Troubleshoot Network if connectivity between nodes fail.


1 comment:

Ali said...

Hello,
I am able to ping private ip addresses however the public host ip address cannot be pinged, any help would be much appreciated.

Ali