< 1 Logical Volume Manager | Commands | 3 Volume Group Administration >
8. Linear Logical Volumes
https://www.udemy.com/course/a-complete-guide-on-linux-lvm/learn/lecture/13061988#overview
Creating the Volume Group
- Volume Group is a pool of the physical volumes (PVs)
- Volume Groups are divided into Logical Volumes
- Logical Volumes are allocated into (mapped to) the same size as the Physical extents (PE) [See Logical Volumes below]
- 1 PE = 4MB
- If PV1 (Physical Volume 1) = 100MB, there will be 25 (100/4) Physical Extents
- If PV2 = 100MB, there will be 50 PE
- VG1 (Volume Group 1) = PV1 + PV2, so 300MB = 75 PE.
Logical Volumes
- These can be used by your applications
- When PE are assigned to a Logical Volume, they change from PE to LE (Logical Extents)
- If 1 PE = 4 MB, then 1 LE also = 4 MB (Always 1 to 1)
Different types of Logical Volumes
- Linear
- These aggregate space from one or monre physical volumes into one logical volume.
- If you have three 100GB disks, you can create a 300GB logical volume.
- The physical storage is concatenated.
- These aggregate space from one or monre physical volumes into one logical volume.
9. Volume Group Creation
Creating Volume Groups
After the Physical Volumes have been created, create the Volume Group
Commands
Find which volumes are available
fdisk -l
Display the Physical Volumes
pvdisplay /dev/sdxn
Example:
# pvdisplay /dev/sda3 --- Physical volume --- PV Name /dev/sda3 VG Name XSLocalEXT-cc138e33-c171-6d3f-e559-f9649d47ad75 PV Size 196.97 GiB / not usable <13.32 MiB Allocatable yes (but full) PE Size 4.00 MiB Total PE 50422 Free PE 0 Allocated PE 50422 PV UUID 14dfcf-uhNt-wav7-d1jH-hdOH-fGCr-nABNQi
Create Volume Groups
vgcreate <groupName> /dev/sdx1 /dev/sdx2 ...
Display Volume Groups
vgdisplay <-v> </dev/GROUPNAME>
-v: Show Physical Volume information
Example:
$ sudo vgdisplay --- Volume group --- VG Name XSLocalEXT-cc138e33-c171-6d3f-e559-f9649d47ad75 System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 2 VG Access read/write VG Status resizable MAX LV 0 Cur LV 1 Open LV 1 Max PV 0 Cur PV 1 Act PV 1 VG Size 196.96 GiB PE Size 4.00 MiB Total PE 50422 Alloc PE / Size 50422 / 196.96 GiB Free PE / Size 0 / 0 VG UUID PQfRRm-HJvu-2L3r-ohPX-tWaj-azeD-mwIaxj
With -v
--- Logical volume --- LV Path /dev/XSLocalEXT-cc138e33-c171-6d3f-e559-f9649d47ad75/cc138e33-c171-6d3f-e559-f9649d47ad75 LV Name cc138e33-c171-6d3f-e559-f9649d47ad75 VG Name XSLocalEXT-cc138e33-c171-6d3f-e559-f9649d47ad75 LV UUID PpOE7h-qUkF-grNR-2zxi-GMZC-S9HQ-mKhJY6 LV Write Access read/write LV Creation host, time citrix01, 2020-04-06 17:42:57 -0500 LV Status available # open 1 LV Size 196.96 GiB Current LE 50422 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:0 --- Physical volumes --- PV Name /dev/sda3 PV UUID 14dfcf-uhNt-wav7-d1jH-hdOH-fGCr-nABNQi PV Status allocatable Total PE / Free PE 50422 / 0
10 – 12. Practice Sessions and Command review
These are all Commands
13. Striped Logical Volumes
https://www.udemy.com/course/a-complete-guide-on-linux-lvm/learn/lecture/13062136#overview
Just like a RAID array, this is good for high I/O
Example 1: The following command creates a striped volume across 2 PVs (-i) with a stripe of 64KB (-I). The logical volume is 50GB (-L) named strpvol (-n) and is carved out of VG vglab.
- The default stripe size is 64kB. If a number is submitted, it will be assumed to be kB
lvcreate -L -i 2 -I 64 -n strpvol vglab
Example 2: Specify the exact extents to use in your Logical Volume striped array
lvcreate -l 100 -i 2 -n strpvol /dev/dec1:0-49 /dev/ded1:50-99
14. Demonstration for Section 13.
