Subject: Re: Logical Volume Managers
To: Christian Limpach <chris@Nice.CH>
From: Bill Studenmund <>
List: tech-kern
Date: 06/24/2000 23:23:03
On Tue, 20 Jun 2000, Christian Limpach wrote:

Note: you posted the same week as Usenix, a conference with a number of
NetBSD folks in attendance. :-)

> 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).

You've kinda muddled questions here. It's one question to have a softc per
vg, one overal, and one per lv. It's another quesiton at to what is in
each softc. If you need per-vg, per-pv, and per-lv storage, then you need
three softc's. :-) Well, three sets of private storage.

What exactly is a buffer pool? I think one struct disk per vg is no big

> 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 use disklabels?

Disklabels are one way to divide up a disk, and LVM's are another. Each lv
is used in ways similar to a partition, so it doesn't make sense to me for
them to be subdivided.

How are you divvying up device numbers? I'd have thought an LVM would just
grab one major device number for lv's, and each lv, as found, would get a
particular minor number. You wouldn't need to be doing the unit/partition
division trick.

What does the LVM do here?

> 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.

ccd's are pseudo-devices, and pseudo-devices are staticaly allocated at
boot. There's nothing which will come along and say, "oh, I found a ppp on
this bus," so they are treated a little different in the configuration

I'm not sure, but I think it'd be fine to make vg's pseudo-devices (you'll
probably have a good handle on the number of vg's you'll have around at
config time). Also, I think you can use the config framework to find lv's
under vg's (if not, you can probably talk Jason into doing it).

Take care,