[linux-lvm] calculating free capacity from pvdisplay and lvdisplay

Stuart D. Gathman stuart at bmsi.com
Wed Aug 11 22:40:22 UTC 2010


On Wed, 11 Aug 2010, Daksh Chauhan wrote:

> This is interesting, and I understand your explaination Ray... But,
> how can I figure out how much data is on each PVs??

If by "data" you mean "allocated to LVs", then the free PPs for each PV tells 
you the answer.

But perhaps by "data" you mean "allocated to LVs *and* allocated to files
in the (arbitrary) filesystems on those LVs".

This would be difficult (and probably pointless).

1) Create a map for each LV of data blocks in use.  Obtaining this map is
   filesystem dependent, and very different for each filesystem type.

2) Use the LP->PV mapping for each LV to map in use filesystem blocks to PPs.

3) Count the PPs for each PV, and subtract from the total for each PV to get
   the total in use by files in each respective filesystem.

The whole point of LVM is that LVM knows *nothing* about the filesystems
that you put on the LVs.  You would not be asking the question unless:

a) You are coming from Sun ZFS, where the "LVM" *does* know about the
   filesystems.  (The drawback is that you can only ever use the ZFS
   filesystem.)

b) You are unclear on the concept.  Perhaps the explanation of how  
   it *could* be accomplished will illuminate.  Note especially the point
   in step 1 - "the map is filesystem dependent".

-- 
	      Stuart D. Gathman <stuart at bmsi.com>
    Business Management Systems Inc.  Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flammis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.




More information about the linux-lvm mailing list