5

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.

1
  • 1
    I don't know for sure that you can't create a PV from a LV and make a VG containing that PV, but it sounds like a maintenance nightmare. I strongly suggest that you carve off a PV and put it in its own VG called nova-volumes. Mar 5, 2012 at 17:15

1 Answer 1

3

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
8
  • Added the use case description. Mar 5, 2012 at 14:16
  • 1
    Guess you could do it this was, but I would reconfigure the vg to use less space, (backup/restore), then create nova-volume vg/lv separate instead of layered. Regardless, it will work. I don't know where issues might arise, say with snapshots.
    – bsd
    Mar 5, 2012 at 15:48
  • @bdowning Is it really possible? I thought only supported block devices could be LVM physical volumes, not including LVM logical volumes. Mar 5, 2012 at 17:13
  • 1
    Empirically speaking, it works. As I said I would not pursue this path except either experimentally or as a last resort. I have no idea what implications this config holds. Try it, it does work.
    – bsd
    Mar 5, 2012 at 17:46
  • @bdowning Ok, thanks. I fully agree that I'd only do this as a last resort, it sounds high-maintenance. Mar 5, 2012 at 18:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .