LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Enterprise (https://www.linuxquestions.org/questions/linux-enterprise-47/)
-   -   Best Practice in Cloning RHEL VMs in VMWare (https://www.linuxquestions.org/questions/linux-enterprise-47/best-practice-in-cloning-rhel-vms-in-vmware-4175533911/)

JockVSJock 02-13-2015 09:44 AM

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

n2studio 02-17-2015 12:24 AM

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.

Ihatewindows522 02-17-2015 09:05 AM

Quote:

Originally Posted by JockVSJock (Post 5316569)
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.

custangro 02-24-2015 10:05 AM

Quote:

Originally Posted by JockVSJock (Post 5316569)
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

JockVSJock 02-24-2015 11:19 AM

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 (Post 5322573)
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



TX_SCUBA 08-05-2016 12:03 AM

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


All times are GMT -5. The time now is 02:10 AM.