Linux Logo

One Way to “sysprep” a Linux Template to Clone

An anoyance with cloning a Linux virtual machine is that the /etc/sysconfig/network-scripts/ifcfg-eth0 file may contain a UUID and HWADDR which can be removed and the /etc/udev/rules.d/70-persistent-net.rules can be deleted or zero’ed out. So, here are the steps I use to create a “template”.

  • Remove the UUID and HWADDR lines from the /etc/sysconfig/network-scripts/ifcfg-eth0 file.
  • > /etc/udev/rules.d/70-persistent-net.rules to zero it out.
  • Run sys-unconfig. (This utiltiy resets a copy of variables and provides you options upon reboot to change a couple of options, but use man sys-unconfig)
  • Done.

After cloning the system, the first screen should be the option to set a root password. Since, I was satisfied with the network settings, I left them alone. However, under DNS Configuration, I changed the hostname. Everything seems to be okay, so left those settings alone. Once completed, a login prompt with the new hostname is presented. Done.

In the past, where I didn’t do the above three steps, I would have to delete the rules file, make edits to the ifcfg file and run setup to change the hostname and still have to reboot the system. This method eliminates considerable downtime.

Reference(s)
http://gregcarriger.wordpress.com/2012/05/18/centos-6-2-sysprep/