Templates and LVM Storage - Could Create a VM from anotther .raw?

Feb 6, 2013
47
0
6
35
Trujillo
Hi there,

I have a LVM disk for storage, for this I only can create kvm machines in raw extension.
If I have a machine VM-101 (RAW) with Apache or something similar, and I want to create other 7 machines like VM-101. How could I do this?

I think that the only way is create a VM an then replace the vm-XXX-disk-1 with:

dd if=/dev/datastore/vm-101-disk-1 of=/dev/datastore/vm-102-disk-1

Is it the only way?

Thanks
 

Jérôme

New Member
Feb 11, 2013
17
0
1
France
Hi there,

I have a LVM disk for storage, for this I only can create kvm machines in raw extension.
If I have a machine VM-101 (RAW) with Apache or something similar, and I want to create other 7 machines like VM-101. How could I do this?

I think that the only way is create a VM an then replace the vm-XXX-disk-1 with:

dd if=/dev/datastore/vm-101-disk-1 of=/dev/datastore/vm-102-disk-1

Is it the only way?

Thanks

Hi,

"datastore" is your LVM VG ?

With dd command you will only copy the disk but you need to create/copy a VM file configuration which are in "/etc/pve/qemu-server/100.conf" and replace the disk and MAC network..

cp /etc/pve/qemu-server/105.conf /etc/pve/qemu-server/XXX.conf
nano /etc/pve/qemu-server/XXX.conf (change the disk information)

In the WebGUI, remove the network controller, then add a new one to change the MAC address.

Code:
bootdisk: virtio0cores: 2
keyboard: fr
memory: 1024
name: NFS
net0: virtio=66:A9:2D:65:92:21,bridge=vmbr0
ostype: wxp
sockets: 1
vga: std
virtio0: tcmsrvnfs:105/vm-105-disk-1.raw
virtio1: tcmsrvnfs:105/vm-105-disk-2.raw

I hope this is what you asked.


Regards
 
Feb 6, 2013
47
0
6
35
Trujillo
Hi,

Yes, datastore is the LVM Storage.

But I need to create VM, step by step with Proxmox VE WebGUI, no?
If I do this I could only change the disk with dd, configure network, and works perfectly....

could I do this with a template or in WebGUI (like vmware) or command line with something like Import VM???

Thanks!!
 

Jérôme

New Member
Feb 11, 2013
17
0
1
France
Hi,

Yes, datastore is the LVM Storage.

But I need to create VM, step by step with Proxmox VE WebGUI, no?
If I do this I could only change the disk with dd, configure network, and works perfectly....

could I do this with a template or in WebGUI (like vmware) or command line with something like Import VM???

Thanks!!

There is not 'import VM' in the WebGUI.

If you want to have a second icone available in the WebGUI you need to copy the configuration file which are in /etc/pve/qemu-server/XXX.conf

At this time, you have a new XXX VM available in your WebGUI.

To have a clone of your first VM, say 101, so you can dd the 101's disk and rename to 102.
You need to change the name of the disk in the configuration file for when you will start the vm, it use the disk 102. It's this line (depend on what controller and storage you have) : "virtio1: tcmsrvnfs:105/vm-105-disk-2.raw"
Warning about the MAC @ in the VM configuration file, you must not have 2 MAC @ identical. To change the MAC address, delete the controller from the WebGUI and then add a new one.

If you want to 'Import VM' from Vbox, VMware, or anything' it's the same thing. Step by step

- Copy a vm configuration file in /etc/pve/qemu-server/XXX.conf
- Add a disk (.RAW .QCOW2 .VMDK) in LVM storage, NFS storage, local storage, ...
- Match disk name in the configuration file
- Change the MAC address
- That's all


I hope it help you.
Regards
 
Last edited:

hotwired007

Member
Sep 19, 2011
533
4
16
UK
I would use the backup/restore function and restore it to a different machine ID - so taht you have an identical clone which you can then change the machine settings afterwards.
 

Jérôme

New Member
Feb 11, 2013
17
0
1
France
Hi,

To backup/restore a VM you can use the WebGUI to backup and the command line to restore to another VMID.

The restoration like this : qmrestore /mnt/pve/tcmsrvnfs/dump/vzdump-qemu-102-2013_02_26-09_ 59_58.tar.gz -storage tcmsrvnfs 220

Where "/mnt/pve/tcmsrvnfs/dump/vzdump-qemu-102-2013_02_26-09_59_58.tar.gz" is the path to the backup VM, "-store tcmsrvnfs" is the destination of the restoration VM and "220" is the new VMID.


About "qmrestore", you don't need to change/add/modify the configuration file, qmrestore will do it for you but you need to change the MAC address again.

Regards
 
Last edited:
Feb 6, 2013
47
0
6
35
Trujillo
Hi, I create a backup with:

vzdump VMID -compress gzip --dumpdir DIR --mode snapshot
and then I create a script that execute:


qmrestore BACKUP -storage STORAGE New-VMID
and edit /etc/pve/qemu-server/New-VMID-conf with Name, MAC and TAG information

Thanks!!
 

Jérôme

New Member
Feb 11, 2013
17
0
1
France
Hi, I create a backup with:

vzdump VMID -compress gzip --dumpdir DIR --mode snapshot
and then I create a script that execute:


qmrestore BACKUP -storage STORAGE New-VMID
and edit /etc/pve/qemu-server/New-VMID-conf with Name, MAC and TAG information

Thanks!!

Hi,


You'r welcome, I'm glad it help you.



Regards
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE 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 your own in 60 seconds.

Buy now!