How to display used devices/free space when using LVM?

Solution 1:

This is relatively easy. Use lvdisplay to show logical volumes, vgdisplay to show volume groups (including free space available) and pvdisplay to show physical volumes.

You should get all the data you need from those three commands, albeit with some work to figure out what all the various bits of data mean.

Solution 2:

pvs, vgs and lvs are convenient easy-to-read alternatives to pvdisplay, vgdisplay and lvdisplay if you only need a summary. E.g. :

# pvs
  PV         VG     Fmt  Attr PSize   PFree 
  /dev/sda2  fedora lvm2 a--  232,59g 20,87g

Solution 3:

The "maps" option is what you are after. This works at the lv level as well as pv.

So if you want to see what room an LV is taking up on a volume, do

lvdisplay -m <volumegroupname>

If you want to see the usage of PVs, do

pvdisplay -m

Solution 4:

I like to use lsblk

lsblk -ao NAME,FSTYPE,FSSIZE,FSUSED,FSUSE%

Output enter image description here

Tags:

Linux

Lvm