3. Xen virtual machine replication
The idea of replicating a virtual machine:
Copy the virtual machine disk file img first
Copying the configuration file / etc/xen of the virtual machine
Modify the configuration file, hostname and network card information of the replication virtual machine
1. View the configuration file of an existing virtual machine
1) location of virtual machine configuration file / etc/xen/dd
2) Virtual Machine Profil
# cat / etc/xen/dd
two。 Copy xen virtual machine disk files
# cp / data/dd.img / data/dd2.img is a bit long. It has something to do with your local hard drive Icano.
3. Copy and modify new virtual machine configuration files
# cd / etc/xen/
# cp dd dd2
# vi dd2
# modify instructions:
(1) modify name to a new virtual machine name
(2) uuid changes the last few data.
(3) change the disk to the actual path.
(4) vif modifies the MAC address of the network card to change the last few data
4. Start a new virtual machine and modify the hostname and IP address
(1) start the virtual machine
You can see that the dd2 virtual machine has been started.
(2) console enters the virtual machine
# xm console dd2
Startup process: mine failed
Virt-manager &
The password of root is the password of the dd virtual machine before replication
(3) modify the host name of the virtual machine
# vi / etc/hosts
# vi / etc/sysconfig/network
Restart
Reboot
(4) modify the IP address of virtual machine
The network card has no information at all.
Find the mac address of the network card through the console
Modify MAC address and IP address
Restart the network card
Service network restart
If not, delete the following file
Cd / etc/udev/rules.d
Ll
Delete the files inside
Restart the virtual machine
Root
Or restart the network card
# cat / etc/sysconfig/network-script/ifcfg-eth0