Discussion:
[linux-lvm] thin volume usage report
Xen
2017-04-16 09:47:00 UTC
Permalink
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.
Xen
2017-04-16 10:27:39 UTC
Permalink
Post by Xen
This script will take a thin pool as a parameter (or search for all
existing)
and obtain all non-snapshot volumes.
Currently though it will paste the reports together in parallel if it
finds more than one pool :p

name pct size name pct
size
------------------------------
------------------------------
crazy 0% 0.00m data 38.66%
15.43g
------------------------------ + home 8.22%
3.28g
total 0% 0.00m sites 33.55%
13.39g

------------------------------ +
reported 0.00% 0.00m total 80.43%
32.11g
available 100.00% 32.00m
------------------------------ + reported 80.50%
32.13g
full size 100.00% 32.00m available 19.50%
7.78g

------------------------------ +
full size 100.00%
39.91g

I don't know how many thin pools people might have :p.

I guess I should make a number of forms available but it is so much work
:p.

Lol.

Current version is at :
http://www.xenhideout.nl/scripts/thin_size_report.sh.txt

Running it will crash your system and send your brain contents to NASA.

But it might also produce the above output or something similar.

It needs access to /sbin/lvs and /sbin/vgdisplay but I guess there is
really only one binary.
Xen
2017-04-17 21:07:07 UTC
Permalink
New format:

name pct size
---------------------------------
data 38.66% 15.43g
home 3.32% 1.32g
sites 14.47% 5.77g
--------------------------------- +
volumes 56.45% 22.53g
snapshots 5.07% 2.10g
--------------------------------- +
used 61.52% 24.55g
available 38.48% 15.36g
--------------------------------- +
pool size 100.00% 39.91g


Old format:

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

Loading...