Today, as promised in yesterday's post (where we came full circle from getting started with LVM, and using monitoring and display commands to removing those same LVM devices), today we've got a little quick command reference of the most commonly used LVM commands.
You may have noticed that I named Linux and Unix in the title of this post. That's because HP-UX's implementation of LVM is very similar to Linux's, and this reference basically works for both of them :) If you're interested in specifics on most of these commands, please refer to our previous posts. We'll note commands in this reference that we "haven't" covered yet.
And, off we go. Hopefully this will help out if you ever need a one-stop-shop for that LVM command you've been looking for. In future posts, we'll definitely be looking at more advanced LVM concepts. For instance, we haven't even begun to look at things like setting up RAID or any form of advanced manipulation of the physical volumes, logical volumes and volume groups we created. You have our promise that posts on theses subjects will be forthcoming. Just maybe not tomorrow ;)
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. We'll be looking at the differences, and similarities, between all of these in future posts, for sure.
Until then. Enjoy :)
Tuesday, June 17, 2008