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
    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. – Gilles 'SO- stop being evil' Mar 5 '12 at 17:15

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
| improve this answer | |
  • Added the use case description. – Lorin Hochstein Mar 5 '12 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 '12 at 15:48
  • @bdowning Is it really possible? I thought only supported block devices could be LVM physical volumes, not including LVM logical volumes. – Gilles 'SO- stop being evil' Mar 5 '12 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 '12 at 17:46
  • @bdowning Ok, thanks. I fully agree that I'd only do this as a last resort, it sounds high-maintenance. – Gilles 'SO- stop being evil' Mar 5 '12 at 18:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.