 Hello everybody! Watch this video to find out how to work with LVM, a logical volume manager, in a link-separating system, how to install it, create a logical volume, mount it, and how to recover any data you have accidentally deleted from such a volume. In our channel and blog you will find solutions to any problem, from installing an operating system or configuring it to fixing possible bugs and errors or optimizing mobile gadgets. Our specialists will answer any questions you ask in your comments under the videos or articles. If you need to create one or several additional logical volumes to store data, or combine several drives into one volume, and do it all without having to stop applications, unmount, or repetition or hard disk, this utility is exactly what you're looking for. LVM, which stands for Logical Volume Management, is a system of managing volumes which is available for every Linux distributive and more flexible than the traditional means of management. So what is LVM? The volume manager provides a new level of interaction between your operating system and disks or volumes which this system is using. In a conventional disk management pattern, the operating system looks for available drives first and then checks what volumes are available on these devices. With LVM, however, drives and volumes can be treated in such a way that a single drive can contain several disks and volumes. If the disk space is treated like that, the operating system will see no difference between them and the volume manager will show the operating system only the volume groups, disks and partitions that you have configured. This is a very powerful system of managing volumes containing data. It allows to create logical volumes spanned across physical partitions, and such volumes will be shown in the operating system as conventional devices containing data, that is, as traditional partitions. The main benefits of this manager are that, first of all, you can create a group of logical volumes over any number of physical volumes. And secondly, the logical volumes can be resized easily and on the fly. In addition, LVM supports snapshots, copying volumes on the fly, and mirroring options similar to those in RAID 1. If you are going to use LVM options for the first time, you have to install it. Here is the command you need for installation. Type it, and then hit Yes to confirm. In some versions of Linux, the logical volume manager is included by default. You can check it by running the LVM command in the terminal window. When the manager is installed, you can move on to dealing with disks. Here we are, with three empty hard disks, 300 gigabytes each, which are unformatted and without any partitions. The easiest way to format a disk is by using a disk management utility. Click on a disk, open Advanced Settings, then Format Partition, specify the name and file system, next, and click Format again to confirm your action. Now, you'll need the password to your administrator account. Now that the disk is formatted, repeat the operation for every other disk, which is not. Also, a disk can be formatted with a terminal, using the fdisk command. First of all, sign in as SuperUser with a root account. So do I, enter the password? Now run the following command, where sdb stands for the unformatted disk. Before you continue, make sure you have selected the right disk, because this operation erases all data from the disk. Type and create a new volume, press P to set it as primary, 1 the first partition, then hit Enter twice. Now let's get the volume ready to be used with LVM. Type T to change the volume type, and then 8E to assign LVM type. Check the volume properties by pressing P. You can see everything is okay, a new formatted volume with the name sdb1 appeared. Press W to record the changes. In the same way, format all the disks which are not formatted yet. Now, create a physical LVM volume on the partition you have just created, enter the following command, and repeat it for each of the disks. Now, let's build a volume group of three disks. All you need is a single command, where VG1 is the name of a new volume group. Actually, you can use any name you prefer, but it's recommended to put the VG letter combination before the name, so that you can know that it is a volume group. After you've combined disks into a group, you can create logical volumes to be used by LVM. Here is the command to create a logical volume, where the L stands for the size of the logical volume. It is 10 GB in this case. The N assigns a name to the volume, and the VG1 indicates from which volume the space should be taken. If there is any data on the disk, the operating system will warn you about it. Type yes to confirm your decision to erase the information. All that we still have to do is to format the volume in the Disk Management utility and mount it. Now, you can see a new partition appear in the Disk Management window. Click on it to open Advanced Settings and then Format Partition. Specify the name and file system. Next and click Format again. Type the root account password and click here to start mounting. That's all. The volume is ready to use. If you need to format it with the terminal, type the following command. Don't forget File System EXT4, name of the group and volume name. To mount it, type the following. And then continue with this command. And now the volume is mounted. One of the advantages offered by Logical Volumes is the opportunity to add a new hard disk on the fly and expand the volume group. And on the contrary, if there is a hard disk in the volume group which is not in use, you can remove it. There are three main tools to make physical volumes, volume groups and logical volumes larger or smaller. Resize. It can shrink or expand physical volumes and logical volumes, but it doesn't work with volume groups. Extend. It makes volume groups and logical volumes larger. And finally, reduce. It makes volume groups and logical volumes smaller. To add a new hard disk to a volume group, you should format it first. And I have described this procedure a minute before. After that, you add a disk to a volume group with disk command, where VG1 is the group name and SDU1 is a new disk you have just formatted. To see detailed information on the disks included into LVM, run the PVDisplay command. It displays the path to a physical disk, the name of the virtual group where it belongs, the information on the free and used disk space, disk ID and many other things. On the contrary, to remove a logical volume, make sure that it is disconnected, unmounted, then run the LVRemove command and the volume will be removed. You can remove a volume group as well. For this purpose, unmount the logical volume first with disk command. After that, remove it with the command LVRemove. Type the command and hit Yes to confirm your decision. When the removal operation is successful, you will see this message. VGRemoveVolumeLV1 Successfully Removed After that, you can remove the volume group with the command VGRemove. That's all. The group is removed successfully. The last step is to remove all the disks that belong to this group, with the command PVRemove. Now, all the data on the physical volume is removed successfully and all the disks are back to their original state. If you accidentally removed important information from a logical volume, you can still restore it with the help of Hetman Partition Recovery. This utility supports data recovery from partitions created with the logical volume manager, so you'll have your data back without a sweat. At the moment, there is no version of Hetman Partition Recovery for Linux, but it does support a wide range of file systems used in Windows, macOS, Linux and Unix. The program will fix any errors in the logical structure of the hard disk and recover all of its contents. You can run this tool in Linux with the help of a virtual machine. Install Windows as the second operating system on your computer or just connect the disk to a Windows computer. As you can see, the program recognized the logical volume without effort and now it displays all the data on this volume. Start with running FastScan. Right click on the disk, open FastScan. And when the scan is over, the program will display the results in the right side of the window. Removed elements are marked with the red cross. If the FastScan doesn't find the data you need, then use full analysis. The next step is to select the files you want to recover. Click Recover it, select where you want to save them, and click Recover again. When the process is over, you will find the recovered files in the folder you have selected. Summing up Today we have explored how to create LVM volumes in Linux, how to configure resize and mount LVM in Linux and how to remove it. Now you know how powerful this technology is and how many advantages it can give you, no matter where you use it – on a server or on a home computer. And that is all for now. Hopefully this video was useful. Remember to click the Like button and subscribe to our channel. Push the bell button to receive notifications and never miss new videos. Leave comments to ask questions. Thank you for watching. Good luck.