LVM or Logical Volume Management
used to create, manage and delete logical volumes in Linux operating systems. LVM provides RAID like architectures for disk drives. We can create single logical volume from multiple physical disks.
LVM或Logical Volume Management
用于在Linux操作系统中创建,管理和删除逻辑卷。 LVM为磁盘驱动器提供了类似于RAID的体系结构。 我们可以从多个物理磁盘创建单个逻辑卷。
基本 (Basics)
LVM consist of 3 main concepts:
LVM包含3个主要概念:
- Physical Volumes 物理体积
- Volume Groups卷组
- Logical Volumes逻辑卷
Let me explain in a simple manner. By adding one or more than one Physical Volume we will create a Volume Group and than we can create one or more Logical Volume from a Volume Group. As we can see LVM provides some abstraction for disk and partition management.
让我以简单的方式解释一下。 通过添加一个或多个物理卷,我们将创建一个卷组,然后从一个卷组中创建一个或多个逻辑卷。 如我们所见,LVM为磁盘和分区管理提供了一些抽象。
PhysicalVolume1 + PhysicalVolume2 + ... + PhysicalVolumeN => Volume Group
VolumeGroup=>LogicalVolume1
VolumeGroup=>LogicalVolume2
...
VolumeGroup=>LogicalVolumeN
物理体积 (Physical Volume)
Physical Volume is a physical disk or a partition which is the source of the storage. We can also use RAID disks or partitions. Physical volume will be added into Volume Groups and this will add more disk space to the Volume Groups.
物理卷是物理磁盘或作为存储源的分区。 我们还可以使用RAID磁盘或分区。 物理卷将被添加到卷组中,这将为卷组添加更多的磁盘空间。
卷组 (Volume Groups)
Volume Groups a logical disk where one or more Physical Disk will participate. This will create enough disk space in order to create Logical Volumes.Volume groups provides flexibility like adding, removing physical volume , resizing Logical Volume on the fly.
卷将一个或多个物理磁盘将参与的逻辑磁盘分组。 这将创建足够的磁盘空间以创建逻辑卷。卷组提供了灵活性,如动态添加,删除物理卷,调整逻辑卷大小。
逻辑卷(Logical Volume)
Logical Volumes are the virtual disk or partitions created from a Volume Groups. We can resize and snapshot the Logical Volume without any interruption.
逻辑卷是从卷组创建的虚拟磁盘或分区。 我们可以在不中断的情况下调整逻辑卷的大小和快照。
创建卷组(Create Volume Group)
We will start by creating a Volume Group. First we will initialize the physical disk for the Volume Group. We will use pvcreate
command by providing the disk device.
我们将从创建一个卷组开始。 首先,我们将初始化卷组的物理磁盘。 我们将通过提供磁盘设备来使用pvcreate
命令。
$ sudo pvcreate /dev/sdb1
After the disk sdb1
initialized we will create a volume Group named myvg
with the vgcreate
command
初始化磁盘sdb1
之后,我们将使用vgcreate
命令创建一个名为myvg
的卷组。
$ sudo vgcreate myvg /dev/sdb1
创建逻辑卷 (Create Logical Volume)
Than we will create Logical Volume with the lvcreate
command by providing the Volume Group and the Logical Volume name. In this example we will use -n
option for Logical Volume Name and -L
for setting the size of the Logical Volume. The Logical Volume size will be 5GB .
然后,通过提供卷组和逻辑卷名称,使用lvcreate
命令创建逻辑卷。 在此示例中,我们将-n
选项用于逻辑卷名,并使用-L
设置逻辑卷的大小。 逻辑卷大小为5GB。
$ sudo lvcreate -n mypart -L 5g myvg
调整分区大小 (Resize Partition)
LVM provides a lot of features against standard disk usage. We can resize the Logical Volume or partition on the fly without unmounting or restarting the system. This operation also called extending
where we will use lvextend
command. -L
option is used to specify how much disk space will be added .
LVM提供了许多针对标准磁盘使用情况的功能。 我们可以动态调整逻辑卷或分区的大小,而无需卸载或重新启动系统。 此操作也称为extending
,我们将在其中使用lvextend
命令。 -L
选项用于指定要添加多少磁盘空间。
$ sudo lvextend -L 5g myvg/mypart
翻译自: https://www.poftut.com/what-is-linux-lvm-logical-volume-management/