The Logical Volume manager allows us to aggregate multiple disks or partitions together to have more space. It also among other things makes it easy for us to expand or reduce storage to fit our needs.
Physical volumes : sit on top of disk partitions, they are the lowest level of the LVM volumes.
Volumes groups : combine the physical volumes into a big storage pool. Logical volume : a volume group can be divided into logical volumes, they are like disk partition that we can easily expand or shrink.
We use fdisk to create a partition /dev/sdb1:
Creating a physical volume:
We create a physical volume from the "/dev/sda", "/dev/sdb1" and "/dev/sdc" partition using:
We can check if the physical volumes was created using:
For a more summary description of the physical volumes on the system, we could use the command "pvs".
Because we are using the whole disks for "sda" and "sdc", we don't need to partition them first using fdisk as we did we "sdb" to create the /dev/sdb1 partition.
Creating a volume group:
We check that the volume group "vg_name" was created using:
Creating a logical volume:
Creates a two gigabytes logical volume inside the volume group "vg_name".
Creating a filesystem on the logical volume:
Creates an ext4 filesystem on the logical volume "lv_name".
Mounting the filesystem:
To be able to use the logical volume "lv_name" we need to mount it on a mountpoint, for example "/mnt".
We then can check the mounted logical volumes using the below command: