Where are disk config files located in 2.0? (want to use cloned LV outside of PM...)

luminarycrush

New Member
Feb 1, 2012
12
0
1
Hi, I'm wondering where the disk config is located in 2.0 - I didn't see it in the FAQ. The reason is that I want to know if I can clone an LV outside of PM (shutdown VM; take snapshot; create LV of same size as original LV; copy snapshot data to LV via dd) and have this disk appear as storage which I can assign to another VM?

This would also be a handy process if using ZFS as the volume manager instead of LVM.

Thanks.
 

dietmar

Proxmox Staff Member
Staff member
Apr 28, 2005
16,484
315
83
Austria
www.proxmox.com
Re: Where are disk config files located in 2.0? (want to use cloned LV outside of PM.

Not sure what you mean by 'disk config files', but the storage configuration is in /etc/pve/storage.cfg
 

luminarycrush

New Member
Feb 1, 2012
12
0
1
Re: Where are disk config files located in 2.0? (want to use cloned LV outside of PM.

OK, that file shows the 'storage container' configuration... but where does Proxmox record, for example, that a logical volume named 'disk-100-1' is located in 'storage container' named eg 'vmdata_1' and is assignable to a vm?
 

dietmar

Proxmox Staff Member
Staff member
Apr 28, 2005
16,484
315
83
Austria
www.proxmox.com
Re: Where are disk config files located in 2.0? (want to use cloned LV outside of PM.

That is stored inside the VM config /etc/pve/qemu-server/<vmid>.conf
 

luminarycrush

New Member
Feb 1, 2012
12
0
1
Re: Where are disk config files located in 2.0? (want to use cloned LV outside of PM.

OK, so here's the scenario. The whole double-copy thing to clone a VM is WAY too much moving of bits. In VMware it's super simple - copy the VMDK/VMX etc to a new directory in the datastore and 'add to inventory' the VM (this is the most basic of cloning - linked clones in VMware are another topic). I'm trying to find a 'copy once' method in Proxmox. Here's what I'm trying to do:

I have a running VM. Here's the vmid.conf:

ostype: win7
memory: 512
sockets: 1
net0: e1000=82:0D:B2:70:00:0B,bridge=vmbr0
name: vm1
bootdisk: ide0
cores: 1
virtio0: test_store:vm-101-disk-1
ide2: cdrom,media=cdrom


I shut it down and take a snapshot via lvcreate. I then power the VM back up.

I could try to do this with running directly from the snapshot, but I want an independent disk from the snapshot 'gold image'. So now I create an LV the same geometry (well, because it's an LV, the same size) as vm1 above.

Original LV from running system:

--- Logical volume ---
LV Name /dev/test/vm-101-disk-1
VG Name test
LV UUID CgK8Eu-Iwov-V0rQ-YBk1-uGKr-defn-a5sMFn
LV Write Access read/write
LV Status available
# open 0
LV Size 32.00 GiB
Current LE 8192
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1


New LV:

--- Logical volume ---
LV Name /dev/test/vm-102-disk-1
VG Name test
LV UUID RjAYrp-F3uU-s3y1-WFKS-lLLg-fIPg-sBAuB9
LV Write Access read/write
LV Status available
# open 0
LV Size 32.00 GiB
Current LE 8192
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:4


I use "dd" to copy data from the LV snapshot to the new LV, eg:

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

This copies all 32G, even though it's not all in use (not the most efficient, I know. I'm just testing a process). Again, I feel I could use the snapshot and not choose to copy off the data, but I want the snapshot as a base to create multiple clones from.

Now I have a new LV with the same data and geometry as the running VM's LV.

So, I create a new VM in Proxmox - here's the vmid.conf for vm2:

ostype: win7
memory: 512
sockets: 1
net0: e1000=82:0D:B2:70:00:0C,bridge=vmbr0
name: vm2
bootdisk: ide0
cores: 1

I then hand-edit the vmid.conf file for vm2 to attach to the cloned disk:

ostype: win7
memory: 512
sockets: 1
net0: e1000=82:0D:B2:70:00:0C,bridge=vmbr0
name: vm2
bootdisk: ide0
cores: 1
virtio: test_store:vm-102-disk-1


However, Proxmox doesn't see this disk in the config, and an attempt to power it up fails with 'no boot disk'.

What is missing - somewhere the fact that the disk "vm-102-disk-1" is a valid Proxmox-assignable disk is not being registered. How to I do that? Is there another configuration file? Where does the system acknowledge that this LVM disk is valid for use in Proxmox and causes it to appear in the inventory of disks in the 'storage' pulldown? It should be possible to 'connect' an existing disk somehow....
 

tom

Proxmox Staff Member
Staff member
Aug 29, 2006
13,646
420
83
Re: Where are disk config files located in 2.0? (want to use cloned LV outside of PM.

OK, so here's the scenario. The whole double-copy thing to clone a VM is WAY too much moving of bits. In VMware it's super simple - copy the VMDK/VMX etc to a new directory in the datastore and 'add to inventory' the VM ..
you can do exactly the same on Proxmox VE, copy the config and adapt it to your needs and copy the disk images (*.raw, *.qcow2 and *.raw). you do not have to use LVM if you want another thing.
 

e100

Active Member
Nov 6, 2010
1,235
24
38
Columbus, Ohio
ulbuilder.wordpress.com
Re: Where are disk config files located in 2.0? (want to use cloned LV outside of PM.

How about doing it like this:
1. Use vzdump to backup the VM to a compressed backup file.
2. Use qmrestore utility to restore the backup whenever you want to make a clone.

qmrestore even has an option -unique that will ensure the network interface gets a new random MAC address.
 

luminarycrush

New Member
Feb 1, 2012
12
0
1
Re: Where are disk config files located in 2.0? (want to use cloned LV outside of PM.

The process of copying a disk file would work, but I'm trying to do this with minimal VM downtime, and with current filesystem technologies in Linux I can only do snapshots with LVM. ZFS may work, but user-space ZFS is not a good performer, and the kernel-based implementations are not really solid yet from what I understand.

BTRFS is still considered in 'testing' so that's not reassuring.

Somehow there is a way that Proxmox is registering the LVM volume as a disk file. How/where is that being registered? Knowing this would provide the missing piece to make this work... and would pave the way to make snapshot cloning a potential Proxmox feature when used with any capable filesystem (ZFS, BRTFS, a NetApp FAS system, etc...LVM being the most primitave but currently the most available option)

Once you've been able to have snapshots (eg like what a NetApp filer can do) with virtualization which can support it you will be completely spoiled.
 

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!