We are making extensive use of the logical volume manager (LVM) on our Debian servers. But I find it hard to get a good overview on which partitions (LVM as well as native) I have mounted where, from which LV (logical volume) from which VG (volume group) and from which PV (physical volume). There are console tools like "lvdisplay -v" and "lvs" but those always just give me a partial view of everything. What I'd wish for is a textual representation something like:

Volume group "vgmain"
consists of physical volumes:
- /dev/sda1 (300 GB, 50 GB unused)
- /dev/sdb1 (300 GB, 120 GB unused)
- /dev/sdc1 (300 GB, nothing unused)

provides logical volumes:
- lvroot (EXT3 mounted on /, 4 GB, 0.5 GB free)
- lvmysql (XFS mounted on /var/lib/mysql, 8 GB used, 2 GB free)

Volume group "vghuge"
consists of physical volumes:
- /dev/sdc2 (800 GB, 250 GB unused)

provides logical volumes:
- lvhome (XFS mounted on /home, 300 GB, 90 GB free)
- lvbackup (XFS mounted on /mnt/backup, 300 GB, 20 GB free)

Just as an idea how that might look. Is there such a tool? If nothing like that exists yet I think I'll have to script something myself which queries "df", "lvdisplay", "vgdisplay" and "pvdisplay" and creates such an overview.

Thanks in advance.


This didn't take long to write.

  • +1 Beats my cheesy script for completeness, although when I run it, I noticed it's missing volume groups? – Avery Payne Jun 19 '09 at 16:30
  • Hmm, it finds all (both) of my volume groups. – pgs Jun 19 '09 at 16:34
  • Do you have names like vgdata and vgdata2, and vgdata is not displayed (and vgdata2 maybe displayed twice)? If so, try changing 'grep $vgname' to 'grep -w $vgname'. – pgs Jun 20 '09 at 3:00
  • pgs, your script is awesome. Thanks for your contribution. It was even new to me that lvdisplay can show which physical volumes a certain logical volume is living upon. I'll surely deploy this script on my servers. – Signum Jun 21 '09 at 12:09
  • Noticed the script just yet. Nice work. RHEL-like fstabs have entries like /dev/VG/LV though, not /dev/mapper/VG-LV. That is even though the mount command shows the latter mounted, not the former. – wzzrd Jun 26 '09 at 12:58

GNU Parted can give you most of the information you need with

parted -l 

It seems It only fails to effectively link lvm parttion to device mapper devices. I am sure they will welcome your patch. ;-)


Cheesy, but it shows everything (except where the filesystems are mounted). Save it as /usr/sbin/lvms

#lvms command - consolidates all LVM views into a single command
pvscan 1>/dev/null 2>/dev/null
vgscan 1>/dev/null 2>/dev/null
lvscan 1>/dev/null 2>/dev/null
echo "Available Physical Volumes - - - - - - -"
echo "Active Volume Groups - - - - - - - - - -"
echo "Active Logical Volumes - - - - - - - - -"

Follow-up: Pgs (on this page) has provided a much nicer script.


No, I don't think such a script exists. Would be a pretty cool thing to script though. I might actually look into that myself, the next time I have my weekly day-of-scripting ;-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.