#lang en <> = Description = In Linux, Logical Volume Manager (LVM) is a device mapper target that provides logical volume management for the Linux kernel. LVM is used for the following purposes: * Creating single logical volumes of multiple physical volumes or entire hard disks (somewhat similar to RAID 0, but more similar to JBOD), allowing for dynamic volume resizing. * Managing large hard disk farms by allowing disks to be added and replaced without downtime or service disruption, in combination with hot swapping. * On small systems (like a desktop), instead of having to estimate at installation time how big a partition might need to be, LVM allows filesystems to be easily resized as needed. * Performing consistent backups by taking snapshots of the logical volumes. * Encrypting multiple physical partitions with one password. LVM can be considered as a thin software layer on top of the hard disks and partitions, which creates an abstraction of continuity and ease-of-use for managing hard drive replacement, repartitioning and backup. (source: [[WikiPedia:Logical_Volume_Manager_(Linux)|WikiPedia]]) = Theory = {{attachment:LogicalVolumenManager.jpg}} = Command's = == Volume group == To view the free space of your volume group, or the physical storage, run ''vgdisplay''. As you can see, I got 52GB in use and 170GB free. {{{ root@scrat:~# vgdisplay --- Volume group --- VG Name scrat-vg System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 5 VG Access read/write VG Status resizable MAX LV 0 Cur LV 3 Open LV 3 Max PV 0 Cur PV 1 Act PV 1 VG Size 222.82 GiB PE Size 4.00 MiB Total PE 57042 Alloc PE / Size 13436 / 52.48 GiB Free PE / Size 43606 / <170.34 GiB VG UUID e3grIy-rsTn-iUN6-Qpp2-wnnX-R2HP-s3BM7B }}} == Logical volume == We can also see the logical volumes inside the volume group. This is the ''lvdisplay'' command. As you can see, the volume has a size of almost 9GB. {{{ root@scrat:~# lvdisplay --- Logical volume --- LV Path /dev/scrat-vg/root LV Name root VG Name scrat-vg LV UUID m5R02p-mx2h-gbTU-sWsv-n2n6-ov5b-Y8Y9f7 LV Write Access read/write LV Creation host, time scrat, 2020-04-23 18:34:58 +0200 LV Status available # open 1 LV Size 10.00 GiB Current LE 2216 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 254:1 }}} === Resize === You can resize the logical volume. You only '''change''' the partition size, not the formatting! The + is for the amount of data you want to add tothe volume. Without it's the total amount the volume has to become. {{{ root@scrat:~# lvextend -L+5G /dev/scrat-vg/root Rounding size to boundary between physical extents: 4.90 GiB Size of logical volume centos/var changed from 10.00 GiB (1280 extents) to 15.00 GiB (2560 extents). Logical volume var successfully resized }}} === Grow filesystem === To let the filesystem grow, online, use for ext3/4: {{{ resize2fs /dev/scrat-vg/root }}} For xfs based filesystems: {{{ xfs_growfs /dev/scrat-vg/root }}}