[linux-lvm] thin volume usage report

Xen list at xenhideout.nl
Sun Apr 16 09:47:00 UTC 2017


So I concocted another thing:

     name             pct      size
     ------------------------------
     data          38.66%    15.43g
     home           8.22%     3.28g
     sites         33.55%    13.39g
     ------------------------------ +
     total         80.43%    32.11g

     reported      80.50%    32.13g
     available     19.50%     7.78g
     ------------------------------ +
     full size    100.00%    39.91g

This script will take a thin pool as a parameter (or search for all 
existing)
and obtain all non-snapshot volumes.

It then counts the PE usage of all segments of those volumes together.
Then based on the usage % it will calculate the number of extents in 
use.

It will turn that into a percentage of the total amount of extents in 
the pool.

Then it will calculate the size in use and turn it into a human readable 
form based on the LVM xxx.xxs format meaning that megabytes are also 
displayed 123.00m with a max of 999.00m but typically you would see 
0.99g or 2.23g figures.

Goes upto exa :p.

It obtains the VG PE_size (normally 4MB) for size calculations.

The discrepancy between "total" and "reported" is not yet used but 
typically this difference would sit in snapshots...

It would become:

     name             pct      size
     ------------------------------
     data          38.66%    15.43g
     home           8.22%     3.28g
     sites         33.55%    13.39g
     ------------------------------ +
     total         80.43%    32.11g
     unaccounted    0.07%    20.00m
     ------------------------------ +
     reported      80.50%    32.13g
     available     19.50%     7.78g
     ------------------------------ +
     full size    100.00%    39.91g

Or something of the kind.

The idea for this thing is of course to be used in reports but you could 
also run it manually.




More information about the linux-lvm mailing list