We're an ISO27001:2013 Certified Supplier

LVM commands

The Linux Logical Volume Manager (LVM) has been around for many years, providing a level of abstraction between the logical disks seen by the system and the physical disks within the system.

Originally, the commands used to examine Physical Volumes, Volume Groups and Logical volumes were, respectively, pvdisplay, vgdisplay and lvdisplay. Those commands still exist, but they can produce a lot of output.

For some time now there have been alternative versions of those commands that give much less output, and which are useful to know about.

Physical Volumes

The Physical Volumes are the disks underlying the Logical Volumes. We can see a summary of them with the pvs command:

# pvs
  PV         VG        Fmt  Attr PSize   PFree  
  /dev/md0   vg_monnow lvm2 a--  223.44g      0 
  /dev/md1   vg_monnow lvm2 a--    1.82t 350.81g

Here, we can see that there are two “physical” disks, md0 and md1. In this case, the names tell us that those “disks” are actually Multiple Device (md) RAID sets.

Volume Groups

The Logical Volumes within LVM are collated in one or more Volume Groups, We can see a summary of them with the vgs command:

# vgs
  VG        #PV #LV #SN Attr   VSize VFree  
  vg_monnow   2  12   0 wz--n- 2.04t 350.81g

In this case – as if often case with simpler systems – there is only one Volume Group, vg_monnow.

Logical Volumes

Lastly, the Logical Volumes themselves, which we can see with the lvs command:

# lvs
  LV             VG        Attr       LSize   Pool [...]
  home           vg_monnow -wi-ao---- 150.00g
  mail           vg_monnow -wi-ao---- 100.00g
  root           vg_monnow -wi-ao----  10.00g
  swap           vg_monnow -wi-ao----   4.00g
  [...]

Here we can see four Logical Volumes, all of which are members of the vg_monnow Volume Group.

Summary

These commands are quick and simple to use. They hide a great deal of underlying detail, but often the overview of the LVM subsystem that they provide is sufficient.

Could This Linux Tech Tip Be Improved?

Let us know in the comments below.

Leave a Reply

Your email address will not be published. Required fields are marked *

Secure. Reliable. Scalable.

If that doesn't describe your current Linux systems, check out our FREE Linux Survival Guide to help you get your systems up to scratch today!

  • This field is for validation purposes and should be left unchanged.