Last active
March 9, 2017 02:37
-
-
Save pilgrim2go/29364f657f5b915a2921d42e4880495f to your computer and use it in GitHub Desktop.
How to display used devices/free space when using LVM?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://unix.stackexchange.com/questions/103535/how-can-i-find-out-the-free-space-on-an-lvm-pv-in-human-readable-format | |
pvdisplay | perl -plne '$f=$1 if /Free PE\s*(\d+)/; | |
$s=$1 if /PE Size.*?(\d+)/; | |
print " Free Space\t\t",($s*$f)/1048576," GiB" if /UUID/' | |
--- Physical volume --- | |
PV Name /dev/sda2 | |
VG Name MMB | |
PV Size 29.71 GB / not usable 19.77 MB | |
Allocatable yes | |
PE Size (KByte) 32768 | |
Total PE 950 | |
Free PE 221 | |
Allocated PE 729 | |
Free Space 6.90625 GiB | |
PV UUID QfZGfn-a3VV-IRkw-bV9g-6iqm-zXjN-y5e6gr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment