| Commands | Section 2: LVM Logical Volumes >
1. Introduction
https://www.udemy.com/course/a-complete-guide-on-linux-lvm/learn/lecture/13069906#overview
2. The LVM Manager Overview
Traditional Partitioning
- You cannot resize partitions
- You cannot add disks together to create a single drive
Using LVM
- You can combine multiple drives into a single volume group
- The pool can be subdivided into smaller Logical Volumes (LV)
- Any remaining space can be added to a LV.
- Additional drives can be added to the Pool
3 Features of LVM
- Additional flexibility
- Disks can be added to the pool then subdivided in to Logical Volumes
- LVs can be resized
- LVs can be moved around (advanced)
- LVM can be though of Dynamic Partitions
- Create / Resize / Delete “On the fly”
4. LVM Architecture Overview
Terminology
- PV Physical Volume
- Can be a whole disk or a partition
- Volume Groups
- 1 or more PVs combined into a group
- LV
- Partitions of the VG
- Can be formatted as desired
- ext4
- nfs
5. Architecture Diagram
https://www.udemy.com/course/a-complete-guide-on-linux-lvm/learn/lecture/13061948#overview
6. LVM Components
- Physical Volumes PV
- Block device
- LVM Label placed in the second 512 byte sector by default
- First sector = mbr (Master Boot Record)
- Can be placed in any of the first 4 sectors
- Label provides information about
- Identification
- Device ordering (since any device can come up in any order when a system is booted)
- Labels remain persistent across reboots
- Contains random unique UUID for the physical volume.
- First sector = mbr (Master Boot Record)
- 3rd & 4th sectors contain metadata
- See next section
7. Practice Lab
- About Metatdata
- How and when the volume was created
- Information about the Volume Group
- Name and Unique ID
- Version Number
- Incremented whenever the metadata is updated
- Read write properties
- Any admin limits on the number of PV and LVs it may contain.
Creating the Physical Volumes
- Create the Partition
- For a full disk, the first partition starts at 2048 (first 4 512 sectors reserved!)
- Use the rest of the disk as Primary p
- Type t – 8e (Linux LVM)
- Write / Quit
- Continue with any remaining disks
- Create an LVM physical volume
- pvcreate /dev/sdb1
- Repeat for any remaining disks
- Get data for the individual PVs
- pvdisplay /dev/sdb1
- PV Name
- VG Name
- PV size
- Allocat
- pvdisplay /dev/sdb1