I'm looking for a way I can get the free space on an LVM physical volume without having to use a calculator.
I know the pvdisplay
command will show me the size of a PE size as well as the free PE, and thus by multiplying the PE size by the free PE I know the free space in KB. But I'd like a command which tells me the free space in megabytes, gigabytes, etc.
The output of pvdisplay
is:
[root@df02 mysql]# pvdisplay
/dev/cdrom: open failed: No medium found
--- 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
PV UUID QfZGfn-a3VV-IRkw-bV9g-6iqm-zXjN-y5e6gr
So the free space in this case is 32768 KByte * 221 Free PE = 7241728 KiB, or 6.90625 GiB. But that's a lot of math to do without a calculator ;-)
Is there a command which can give me the free space on an LVM physical volume in megabytes/gigabytes?