Quick Reference Of LVM Commands

Quick command reference of the most commonly used LVM commands.

For deeper knowledge it is recommended to read the "man" pages and accompanying documents.

1. LVM Basic relationships. A quick run-down on how the different parts are related

Physical volume - This consists of one, or many, partitions (or physical extent groups) on a physical drive.

Volume group - This is composed of one or more physical volumes and contains one or more logical volumes.

Logical volume - This is contained within a volume group.

2. LVM creation commands (These commands are used to initialize, or create, new logical objects) - Note that we have yet to explore these fully, as they can be used to do much more than we've demonstrated so far in our simple setup.

pvcreate - Used to create physical volumes.

vgcreate - Used to create volume groups. 

lvcreate - Used to create logical volumes.

3. LVM monitoring and display commands (These commands are used to discover, and display the properties of, existing logical objects). Note that some of these commands include cross-referenced information. For instance, pvdisplay includes information about volume groups associated with the physical volume.

pvscan - Used to scan the OS for physical volumes.

vgscan - Used to scan the OS for volume groups.

lvscan - Used to scan the OS for logical volumes.

pvdisplay - Used to display information about physical volumes.

vgdisplay - Used to display information about volume groups.

lvdisplay - Used to display information about logical volumes.

4. LVM destruction or removal commands (These commands are used to ensure that logical objects are not allocable anymore and/or remove them entirely) Note, again, that we haven't fully explored the possibilities with these commands either. The "change" commands in particular are good for a lot more than just prepping a logical object for destruction.

pvchange - Used to change the status of a physical volume.

vgchange - Used to change the status of a volume group.

lvchange - Used to change the status of a logical volume.

pvremove - Used to wipe the disk label of a physical drive so that LVM does not recognize it as a physical volume.

vgremove - Used to remove a volume group.

lvremove - Used to remove a logical volume.

5. Manipulation commands (These commands allow you to play around with your existing logical objects. We haven't posted on "any" of these commands yet - Some of them can be extremely dangerous to goof with for no reason)

pvextend - Used to add physical devices (or partition(s) of same) to a physical volume.

pvreduce - Used to remove physical devices (or partition(s) of same) from a physical volume.

vgextend - Used to add new physical disk (or partition(s) of same) to a volume group.

vgreduce - Used to remove physical disk (or partition(s) of same) from a volume group.

lvextend - Used to increase the size of a logical volume. 

lvreduce - Used to decrease the size of a logical volume. 

You may note that some of these commands vary slightly from LVM1 to LVM2 and also between the pure Linux implementation and HP-UX's Unix version. 

Linux Tips

See Also

Have a Linux Problem
Linux Forum - Do you have a Linux Question?

Linux Books
Linux Certification, System Administration, Programming, Networking Books

Home Index
Linux System Administration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.
The site www.gotothings.com is in no way affiliated with or endorsed by any company listed at this site.
Any unauthorised copying or mirroring is prohibited.