VM cloning, udev and network interfaces on KVM

In my previous post on setting up Oracle RAC on KVM, I mentioned problems with network interfaces & udev after cloning a Scientific Linux (in the following: SL) machine. This is just a short follow-up describing how to successfully clone an SL 63.1 machine on KVM.

Firstly, cloning a VM on KVM can be done using virt-manager or with virt-clone (or even manually, see http://rwmj.wordpress.com/2010/09/24/tip-my-procedure-for-cloning-a-fedora-vm). Choosing the virt-manager method, however, for a SL 63.1 VM that also acts as an ISCSI client, I got the following error message:

Error setting clone parameters: Could not use path '/dev/disk/by-path/ip-' for cloning: iSCSI volume creation is not supported.

Fortunately, the error can be circumvented by temporarily stopping the iSCSI pool. Virt-manager complains about the respective disks not existing, but will perform the clone correctly.

This just as an aside – regarding our topic of network interfaces, by default, virt-manager will automatically choose new MAC addresses for the interfaces.

Now after cloning, restart the iSCSI pool and boot the VM in runlevel 1. Prior to any changes,

ip link show

will show a list of interfaces eth<n+1>, eth<n+2> etc., where eth<n> is the highest number interface name from the clone source.

Checking for udev rules, it turns out


still has the clone source’s MAC addresses (which don’t exist on clone target), but there is a file


that creates the aforementioned <n+1> etc. interfaces.

Now it is sufficient to simply edit the /etc/udev/rules.d/70-persistent-net.rules, entering the new MAC addresses, and remove the /dev/.udev/tmp-rules--70-persistent-net.rules temporary file. On reboot, interfaces will have the expected eth0 - eth<n> interface names.

Of course, on Scientific Linux or other Red Hat like systems, it is also neccessary to edit the /etc/sysconfig/network-scripts/ifcfg-eth<n> configuration files for hardware and IP addresses, and /etc/sysconfig/network for the hostname. And that’s it!