LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices


Reply
  Search this Thread
Old 02-13-2015, 09:44 AM   #1
JockVSJock
Senior Member
 
Registered: Jan 2004
Posts: 1,420
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
Best Practice in Cloning RHEL VMs in VMWare


Let me know if this is not the correct forum for this post or not.

We've been having issues cloning RHEL v5 and v6 from two environments in vSphere. One version of vSphere is our prod environment (v4.1.0) and one is test (5.5.0). I used to think that might be the issue, however we are able to clone Windows servers with no issues whatsoever.

Some of the issues that we are having are duplicate MAC addresses and not being able to assign an IP address.

I've resarched and found recommendations to delete the NIC before doing the conversion process.

Other things that I have found online are to delete and entries for the NIC under /etc/udev/rules.d and

I thought I found a website that said to edit various files under /etc/ssh, however I can't find it at this time.

I was wondering what others are doing to make this process as painless as possible.

thanks
 
Old 02-17-2015, 12:24 AM   #2
n2studio
LQ Newbie
 
Registered: Feb 2011
Posts: 4

Rep: Reputation: 0
Make sure all places where you might have hardcoded IP addresses are changed such as /etc/sysconfig/iptables, /etc/resolv.conf, /etc/ntp.conf, etc. You might want to make a script that uses egrep and sed to find all occurrences of certain values (e.g. host IP, DNS IP, NTP server IP, subnet, etc.) and replace with new ones.

A command like this to find the values:

Code:
egrep -rl --exclude-dir=/dev/shm --exclude-dir=/proc --exclude-dir=/media <... etc ...> \
   "$SEARCH_STRING" / > $TMPFILE
... and then put sed in a for loop to change the values ...
Code:
for FILE in $(cat $TMPFILE); do
   # should check for exceptions/error conditions first
   sed -i "s|$SEARCH_STRING|$REPLACE_STRING|g" $FILE
done
The above script should be run while in single mode on first time booting into a machine.

Last edited by n2studio; 02-17-2015 at 12:26 AM.
 
Old 02-17-2015, 09:05 AM   #3
Ihatewindows522
Member
 
Registered: Oct 2014
Location: Fort Wayne
Distribution: Ubuntu 16.04 LTS
Posts: 616
Blog Entries: 2

Rep: Reputation: 166Reputation: 166
Quote:
Originally Posted by JockVSJock View Post
Let me know if this is not the correct forum for this post or not.

We've been having issues cloning RHEL v5 and v6 from two environments in vSphere. One version of vSphere is our prod environment (v4.1.0) and one is test (5.5.0). I used to think that might be the issue, however we are able to clone Windows servers with no issues whatsoever.

Some of the issues that we are having are duplicate MAC addresses and not being able to assign an IP address.

I've resarched and found recommendations to delete the NIC before doing the conversion process.

Other things that I have found online are to delete and entries for the NIC under /etc/udev/rules.d and

I thought I found a website that said to edit various files under /etc/ssh, however I can't find it at this time.

I was wondering what others are doing to make this process as painless as possible.

thanks
IDK if you can do this in VMware or not, but try exporting a template machine as a virtual appliance. When you go to import it, you should be asked if you want to reinitialize the MAC. Pretty sure Workstation or Studio will let you do that, not sure if the machines will be compatible.
 
Old 02-24-2015, 10:05 AM   #4
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , RHEL
Posts: 1,979
Blog Entries: 1

Rep: Reputation: 209Reputation: 209Reputation: 209
Quote:
Originally Posted by JockVSJock View Post
Let me know if this is not the correct forum for this post or not.

We've been having issues cloning RHEL v5 and v6 from two environments in vSphere. One version of vSphere is our prod environment (v4.1.0) and one is test (5.5.0). I used to think that might be the issue, however we are able to clone Windows servers with no issues whatsoever.

Some of the issues that we are having are duplicate MAC addresses and not being able to assign an IP address.

I've resarched and found recommendations to delete the NIC before doing the conversion process.

Other things that I have found online are to delete and entries for the NIC under /etc/udev/rules.d and

I thought I found a website that said to edit various files under /etc/ssh, however I can't find it at this time.

I was wondering what others are doing to make this process as painless as possible.

thanks
After you clone the VM login and...

1) rm -rf /etc/ssh/ssh_host_*
2) Edit the hostname in /etc/sysconfig/network
3) rm -rf /etc/udev/rules.d/70-*
4) Remove the HWADDR line and UUID line from /etc/sysconfig/network-scripts/ifcfg-eth* file(s). Also change the IP address in this/these files
5) If you'd like, delete all the logs from /var/log and build logs from /root
6) If you'd like to go through setup again then: touch /.unconfigured
7) Always good to do an SELinux relabel: touch /.autorelabel

Then Reboot the VM. This should be good enough. The best practice is to set up a VM as a "template" so that way you only have to do the above steps once.

--C
 
1 members found this post helpful.
Old 02-24-2015, 11:19 AM   #5
JockVSJock
Senior Member
 
Registered: Jan 2004
Posts: 1,420

Original Poster
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
For #5, I don't understand what it means to build the logs from /root

For #6, the RH documentation talks about doing the /.unconfigured, however I don't know why

For #7, I'm also not understanding the SELinux relabel.


Quote:
Originally Posted by custangro View Post
After you clone the VM login and...


5) If you'd like, delete all the logs from /var/log and build logs from /root

6) If you'd like to go through setup again then: touch /.unconfigured

7) Always good to do an SELinux relabel: touch /.autorelabel

 
Old 08-05-2016, 12:03 AM   #6
TX_SCUBA
LQ Newbie
 
Registered: Aug 2016
Location: SATX
Distribution: RHEL 7.1
Posts: 1

Rep: Reputation: Disabled
Talking Clone RHEL 7.1 with VCenter 6.1

Questions:

Does anything need to change, be removed or added for RHEL 7.1?
After you clone the VM login and...

1) rm -rf /etc/ssh/ssh_host_*
2) Edit the hostname in /etc/sysconfig/network
3) rm -rf /etc/udev/rules.d/70-*
4) Remove the HWADDR line and UUID line from /etc/sysconfig/network-scripts/ifcfg-eth* file(s). Also change the IP address in this/these files
5) If you'd like, delete all the logs from /var/log and build logs from /root
6) If you'd like to go through setup again then: touch /.unconfigured
7) Always good to do an SELinux relabel: touch /.autorelabel

Then Reboot the VM. This should be good enough. The best practice is to set up a VM as a "template" so that way you only have to do the above steps once.

--C

Also do you know if the above changes also modify IP/Host info for the following services as well: SRM/ Siteminder/ TC Server/ HTTP/ DB Connect Strings/ Puppet/ DynaTrace/ Log Insight/ HPOV/ HPOM/ NetBack Up/Application.properties/Hibernat.properties?

If not would indicate what additional files need to be updated?

Thx much
 
  


Reply

Tags
clone, eth0, mac address, rhel, vmware



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
XEN or VMWARE workstation for Windows VMs on Debian dobradude45 Debian 2 12-14-2013 06:56 AM
Problem converting VMWare VMs to RHEV format. just a man Red Hat 1 12-13-2011 09:32 AM
Snapshot alternative for VMware 4 - RHEL5.5 VMs Frustin Linux - Enterprise 5 09-18-2010 03:47 AM
upgrade RHEL 4.3 to RHEL 4.8 to fix CIFS bug - best practice? jaredk51 Linux - Enterprise 6 04-19-2010 05:35 AM
Migrate VMWare images to other VMs? SlowCoder Linux - General 2 06-13-2008 01:01 PM

LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise

All times are GMT -5. The time now is 04:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration