Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question
    
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 Mar 5 '12 at 17:15

1 Answer 1

up vote 2 down vote accepted

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
share|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. –  bdowning 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 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. –  bdowning 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 Mar 5 '12 at 18:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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