Why we use LVM?
LVM (Logical Volume Manager) is primarily intended for storage pool management and is therefore suitable wherever storage space must be optimally utilized, such as in high-traffic environments and where multiple servers or workloads share a set of disks. It provides flexible storage solutions that are more scalable than conventional physical volumes, allowing administrators to extend the capacity of volume groups without needing to perform additional offline operations on member disks.
Additionally, LVM enables easy disk migration, including adding/removing drives and switching between mirrored or striped RAID configurations. Consequently, its use is advantageous in situations where data storage demand may fluctuate over time or when the need for redundant backup solutions arises (e.g. for disaster recovery purposes). In that instruction we will consider how to mount exist disk to system!
Mounting a disk
First of all, we need to connect physically or virtuality disk to our system and check them by the command below:
Now we can see printed map info about our disks system with various details, initially we have only vda physical and connect vdb virtual. But what type of disk you choose doesn't matter. Take a look at the last column with name MOUNTPOINTS that literally mean mount on the filesystem. If your disk doesn't display like this or in the filed type you see value none, then install needed utility for our manipulation:
Alright! Not every time system search lvm disk automatically, for manual process we will use command:
Additionally, after utility installation we can see disk space through the command with more detailed info about created volume:
Go ahead, commonly lvm disk activate automatically, but if in your case that doesn't work properly try to use command:
And also for logical volume we need to type command:
Highlight! You need to change every name of device, virtual group and logical volume for yours. Another one significant step, if you have data with already exist filesystem then you can skip that step. For others in that block we will make filesystem on the raw disk, by the command:
In the result we can see summary printed info. For temporary connect we can use command mount, for automatic load we will see below. At the first create or use currently existed folder in my case that /mnt/tmp:
And then mount disk:
For check result of our manipulations type:
Last column indicate our point connection of disk /mnt/tmp! But what if we need to mount automatically disk with startup system? For that in the Debian we can use fstab. That file literally mount all disks contain in them, we just add specified row and system will work. But we need to know some details of disk:
They will print UUID of the needed device and filesystem type, we will use them next.
For make sure that all work properly print last row in the file:
Change UUID, folder where you want mount disk, filesystem and leave without changes defaults with 0 0. Command above allow to add entering values in the file.
For update map disk without restarting we will use:
Make sure that we do everything right:
Also take look at the last column!
Mounting LVM disks on Debian involves connecting the disk, scanning for LVM disks, activating volumes, creating filesystems, mounting, and configuring /etc/fstab. These steps ensure efficient utilization and automated mounting at system startup.