Clone a kvm VM

rmacian

New Member
Apr 30, 2009
7
0
1
I want to clone a Centos 5.3 VM that I have running. I have done the copy-restore procedure with vzdump but now I don't know how to change the IP and the hostname of the new VM. vzctl only provides this for openvz containers and not for KVM.

With XEN I usually mounted the image in loop mode and then change it directly on the config files.

Any idea?
 
I want to clone a Centos 5.3 VM that I have running. I have done the copy-restore procedure with vzdump but now I don't know how to change the IP and the hostname of the new VM. vzctl only provides this for openvz containers and not for KVM.

With XEN I usually mounted the image in loop mode and then change it directly on the config files.

Any idea?

you mix two things: KVM and OpenVZ (these are two different technologies)

as KVM is a full virtualization technology you need to do the network configuration inside the guest OS.

on OpenVZ containers (if you use venet) you can configure the network on the host. (if you veth you need to configure the network also inside the container).
 
With XEN I usually mounted the image in loop mode and then change it directly on the config files.

Thats the way. You can use qemu-nbd to acces the image:

Code:
# load network block device module
modprobe nbd
# connect
qemu-nbd --connect=/dev/nbd0 test.img
# do what you want here, for example
mount /dev/nbd0p1 /mnt
...
umount /mnt
# disconnect the device
qemu-nbd -d dev/nbd0

see "man qemu-nbd" for details.
 
you mix two things: KVM and OpenVZ (these are two different technologies)

as KVM is a full virtualization technology you need to do the network configuration inside the guest OS.

on OpenVZ containers (if you use venet) you can configure the network on the host. (if you veth you need to configure the network also inside the container).

I don't understand. I know the differences but as far as I know vzdump is the only method to automate the backups from the web interface. I am using a tar file that is created through the daily backup. So I need vzdump to restore it.

Thanks dietmar for the tip, but now I see that I have another problem. I have LVM on the guest too so I cannot mount it directly. Anyway, I have found that trying to mount a disk image with LVM is very complicated, you need to create a loop device with losetup, use kpartx to access to the lvm... I went through the easy way. I put a comment in the vlan0 line to the /etc/qemu-server/10x.conf. booted the VM without network and changed all the necessary...
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!