Create a volume group from a logical volume instead of a physical volume

lvm

Is it possible to create a volume group from a logical volume instead of a physical volume? If so, are there any pitfalls in doing so?

Use case:

Installing OpenStack Compute on a a system that already has all of the physical volumes assigned to a singe volume group. The nova-volume service requires a separate volume group, as described in the documentation. I want to know if I can carve off a logical volume and then create the "nova-volumes" volume group.

Best Answer

Yes, it is possible, though you are adding complexity.
I would use this approach either experimentally or as a last resort, only after you have explored other solutions.

paraphrasing man pvcreate "pvcreate initializes PV for later use by the LVM. Each PV can be a ... or meta device ...

Apparently an LV qualifies as a meta device.

Empirically speaking, the following worked just fine

pvcreate /dev/sda16
vgcreate demo /dev/sda16
lvcreate --name lv -l '100%VG' demo
pvcreate /dev/mapper/demo-lv  
vgcreate wrappervg /dev/mapper/demo-lv  
lvcreate --name lv -l '100%VG' wrappervg  
mkfs.ext4 /dev/mapper/wrappervg-lv  
mkdir /mnt/wrapper  
mount /dev/mapper/wrappervg-lv /mnt/wrapper  
touch /mnt/wrapper/foo
Related Question