Subject: Re: Logical Volume Management for NetBSD
To: John Nemeth <jnemeth@victoria.tc.ca>
From: Louis Guillaume <lguillaume@berklee.edu>
List: netbsd-users
Date: 08/17/2006 12:18:18
John Nemeth wrote:
> On Jan 6,  5:40pm, "Jonathan A. Kollasch" wrote:
> } On Wed, Aug 16, 2006 at 03:15:09PM -0700, John Nemeth wrote:
> } >      Probably need to write it from scratch.  It may need changes to
> } > the disk drivers (i.e. the concept of partitions goes out the window),
> } 
> } How can that work?  Non-contiguous area?
> 
>      Yep.  My experience is with HP-UX, not AIX; but, they are probably
> pretty similar.  In HP-UX a physical disk is mapped to a PV (Physical
> Volume).  It is then divided up into 4MB chunks called extents.  These
> chunks are then assigned to LVs (Logical Volumes).  You can assign (or
> unassign) any number of chunks to any LV at any time.  This allows you
> to dynamically resize the "disk" underlying a filesystem.  On HP-UX, if
> you purchase the Veritas filesystem, you can resize the filesystem
> itself on the fly.  With HP's filesystem, you have to unmount it and
> run a program to expand it (you can't shrink it).  If you create
> several filesystems then expand one in the middle, it will have
> non-contiguous space on the physical medium.
> 

I'm sure the differences are mainly with naming, but there are some 
features on the AIX version that are really important:

You have physical disks (or arrays of them) defined as `Physical 
Volumes' (PV).

Each PV is divided up into `Physical Partitions' (PP).

Several PVs are logically joined together to make a `Volume Group' (VG), 
which is essentially a large pool of PPs that can be allocated.

A `Logical Volume' (LV) represents a set of allocated PPs within a 
volume group. There are policies that define which PPs are chosen.

There's the Intraphysical volume allocation policy, which defines the 
position of the PPs on the PVs for each LV, for example outer edge, 
inner edge, center, inner middle, middle.

There's the Interphysical volume allocation policy, which defines 
whether the PPs should be spread between the maximum or minimum number 
of PVs.

Actually there's another level of abstaction: the `Logical Partition' 
(LP). This allows for multiple copies of a PP within the VG. They can be 
striped across several PVs or mirrored etc. I've only ever used 1 PP per LP.

Filesystems get created on Logical Volumes. If you need to resize the 
filesystem, it will resize the LV to suit, assuming there are enough PPs 
available in the VG.

One of the really neat features I've found is the ability to incorporate 
new hardware by extending the VG onto additional PVs. Then there's a 
`reorgvg' command that moves everything into place based on the volume 
allocation policies. You can also `reducevg', to remove old PVs.

I noticed on Linux you can define a disk partition as a PV. This can 
probably be done on AIX too but I've never had a need for this. It is 
handy, though, because I can create a small '/' partition, a swap 
partition and then do the rest of the disk as a PV, allowing for great 
flexibility.

Despite my very limited capacity as a programmer, I'd be willing to help 
in this effort.

Regards,

Louis