In this video, Kevin Dankwardt descibes logical volumes. Learn how to use the lvm command. Various features of the catchall LVM command are demonstrated.
- [Instructor] Logical volume manager or LVM provides a abstraction for viewing physical disks as one thing. You can collect together multiple disks or partitions and treat it as one thing, and it can grow and it can shrink and you also can strip across those physical disks or you can mirror so you got two copies. So you get both flexibility and improved performance.
LVM we can really think of being three levels, so the abstraction of a logical volume is on top of volume groups and physical volumes. Where a physical volume is a disk or a disk partition. You can group those together into a volume group and then you can build from a volume group a piece that will be called a logical volume. So the logical volume can grow and shrink as well as the volume group can grow and shrink.
There are lots of commands involved with LVM including a command called LVM. So there are stand alone commands like pvcreate and vgdisplay and so fourth, but the LVM command itself has similar commands inside and that can be a little more convenient, because it remembers some context where you are. So as to be expected these things are usually privileged commands. So instead of having to do a sudo pvcreate sudo vgdisplay you can do sudo LVM and then within the LVM prompt you can do multiple commands.
So let's look at using LVM, some simple stuff. So on this system I've set up some physical volumes and so fourth. So we'll do LVM, and we get the LVM prompt and we type help and we get lots of stuff. So you can do help button command, like I could say help PVS, and it tells me about options for the PVS command. Let's do the PVS command. So we got to scan a physical volume.
So we see here on this system it recognizes three partitions as physical volumes, and the first two are in a volume group called VG1, and we see the size and how much is free. If I do PV check one of these it tells me yeah it's a logical volume thing and it found metadata. Looks good. If I try PV check on some other partition that it doesn't find as a physical volume it will tell you hey there's no LVM label on that partition.
And I can do a VGS, volume group scan, and it can see that we found one volume group. It's got two physical volumes and so fourth. So that's the simple use of LVM.
- Partitioning storage
- Creating, mounting, and unmounting file systems
- Formatting file systems
- Making volumes with LVM
- Adding storage security
- Managing swap spaces
- Backing up and recovering Linux storage systems
- Working with networked file systems like NFS and SSHFS