Subject: Logical Volume Managers
To: None <>
From: Christian Limpach <chris@Nice.CH>
List: tech-kern
Date: 06/20/2000 01:55:23

I have ported the LinuxLVM ( to NetBSD.  I have
now a couple of questions on how to best make it fit with the rest of
NetBSD.  I used the ccd driver as a basis for this port.

short description of the LinuxLVM:
the LinuxLVM is similar to the IBM/Digital/HP LVMs.  You create physical
volumes (pv) on partitions or whole disks.  You create volume  groups (vg)
which use one or more physical volume.  Each volume group can contain
multiple logical volumes (lv) which can be used like partitions.  The
allocation strategy uses physical extents (pe, fixed size blocks) on the
physical volumes to allocate space for each logical volume.

What's the preferred way to map such a storage organization onto the generic
disk framework?

My current implementation uses one softc containing one struct disk and one
buffer pool.  Each logical volume gets an independent disklabel (generated
on the fly) with one unused and one 4.2BSD partition.

Would it be better to use one softc for each volume group?  Are there
advantages to this solution?  Memory usage would be higher since more memory
would get allocated at boot (one struct disk and buffer pool for each
possible vg).

What about one softc for each logical volume?  Since there's one disklabel
for each logical volume, this would be logical.  But this solution has even
higher memory usage.  I have used one disklabel for each logical volume to
avoid running into the problem of too many partitions per volume group if
there was one disklabel for each volume group.

Why does ccd allocate a limited number of softc's and not only allocate the
softc when the device is configured?  Configuring a ccd allocates memory
anyway, so if there's none available, the bit allocated at boot won't be
enough anyway.

Finally, is there interest in getting this included in the distribution?