LVM (Logical Volume Management) allows you to compile multiple disks and areas from disks into one logical volume and then split again as you like.
PV (Physical Volume) — partition or whole disk
VG (Volume Group) — a single disk assembled from physical volumes
LV (Logical Volume)
Switch to the root user:
sudo -i
Install LVM if it is not already installed (Ubuntu/Debian):
apt-get install lvm2
Let’s look at the information about the disks:
fdisk -l
On the test I have /dev/sda with the system and not marked /dev/sdb.
Let’s make the physical partition all /dev/sdb without partitioning:
pvcreate /dev/sdb
To view the list of physical volumes, use the command:
pvdisplay
Create a volume group named ixnfo:
vgcreate ixnfo /dev/sdb
If necessary, delete as follows:
vgremove ixnfo
Example of viewing existing groups and how much space is left:
vgdisplay
For the test, create a logical volume “temp” of 100 megabytes:
lvcreate -L100 -n temp ixnfo
To view the list of logical volumes, use the command:
lvdisplay
Let’s format it:
mkfs.ext4 -L temp /dev/ixnfo/temp
Create a folder, mount the created volume:
mkdir /mnt/temp mount /dev/ixnfo/temp /mnt/temp
You can unmount it like this:
umount /mnt/temp/
See also:
Adding a disk to LVM
Managing disk partitions in Ubuntu using fdisk