On 06/02/2011 08:28 PM, Richard W.M. Jones wrote:
Maybe I'm not understanding your question correctly, but a
filesystem
is more general than LVM. You can create directories corresponding to
your current VGs and files for your LVs, with the advantage that you
can nest directories which you can't do with LVM VGs.
If you mean nesting in the sense that an LVM2 LV is used as a PV then the tools
support this just fine:
# lvcreate -n nested_pv1_lv -L5G bmr_vg1
Logical volume "nested_pv1_lv" created
# pvcreate /dev/bmr_vg1/nested_pv1_lv
Physical volume "/dev/bmr_vg1/nested_pv1_lv" successfully created
# vgcreate bmr_nested_vg0 /dev/bmr_vg1/nested_pv1_lv
Volume group "bmr_nested_vg0" successfully created
# lvcreate -n nested_pv2_lv -L5G bmr_nested_vg0
Insufficient free extents (1279) in volume group bmr_nested_vg0: 1280 required
# lvcreate -n nested_pv2_lv -l 1279 bmr_nested_vg0
Logical volume "nested_pv2_lv" created
# pvcreate /dev/bmr_nested_vg0/nested_pv2_lv
Physical volume "/dev/bmr_nested_vg0/nested_pv2_lv" successfully created
# vgcreate bmr_nested_vg1 /dev/bmr_nested_vg0/nested_pv2_lv
Volume group "bmr_nested_vg1" successfully created
# lvcreate -n l0 -l 1278 bmr_nested_vg1
Logical volume "l0" created
The 1-extent-per-nesting-level size decrement is to allow for the MDA allocated
on each PV. The pvcreates are also strictly speaking unnecessary on recent tool
versions since a vgcreate will now label a new device automatically but I'm
old-fashioned ;-)
You can view the device nesting via dmsetup:
# dmsetup ls --tree bmr_nested_vg1-l0
[...]
bmr_nested_vg1-l0 (253:10)
└─bmr_nested_vg0-nested_pv2_lv (253:9)
└─bmr_vg1-nested_pv1_lv (253:8)
└─ (9:1)
[...]
# vgs
VG #PV #LV #SN Attr VSize VFree
bmr_nested_vg0 1 1 0 wz--n- 5.00g 0
bmr_nested_vg1 1 1 0 wz--n- 4.99g 0
bmr_vg0 1 4 0 wz--n- 222.82g 25.68g
bmr_vg1 1 3 0 wz--n- 19.53g 6.62g
If things aren't activating properly on boot/reboot then it's likely an
initscripts limitation or bug. Udev based activation should simplify that but
you can also work around it depending on your distro via e.g. rc.local.
Regards,
Bryn.