How to create a LVM group from two hard disk partitions is introduced in this post.
本文介绍了如何从两个硬盘分区创建LVM组。
Assume we have installed two hard disks /dev/sdb and /dev/sdc to the server, our task now is to create one LVM volume group vg_xen for installing LVM backed Xen DomUs from these two disks. We will do this by several steps: create partitions on the hard disks, initialize disk partitions and create a volume group.
假设我们已经在服务器上安装了两个硬盘/ dev / sdb和/ dev / sdc,我们现在的任务是创建一个LVM卷组vg_xen,以从这两个磁盘安装LVM支持的Xen DomU 。 我们将通过几个步骤来执行此操作:在硬盘上创建分区,初始化磁盘分区并创建卷组。
在硬盘上创建分区 (Create partitions on the hard disks)
We can use fdisk to create partitions:
我们可以使用fdisk创建分区:
# fdisk /dev/sdb
Add a new partition by command: n
通过命令添加新分区:n
Select primary partition by: p
通过以下方式选择主分区:p
Select partition number 1: 1
选择分区号1:1
Then select from the first section to the last one.
然后从第一部分选择最后一部分。
Write table to disk and exit by command: w
将表写入磁盘并通过命令退出:w
We can find out the new partition in /dev/ directory:
我们可以在/ dev /目录中找到新分区:
$ ls /dev/sd*
We can find:
我们可以找:
/dev/sdb1
Follow the same procedure to create partition /dev/sdc1
按照相同的步骤创建分区/ dev / sdc1
初始化磁盘分区 (Initialize disk partitions)
Create volume group descriptors at the starts of partitions:
在分区的开头创建卷组描述符:
# pvcreate /dev/sdb1
# pvcreate /dev/sdc1
创建一个卷组 (Create a volume group)
We create LVM volume group vg_xen that contains /dev/sdb1 and /dev/sdc1:
我们创建包含/ dev / sdb1和/ dev / sdc1的LVM卷组vg_xen:
# vgcreate vg_xen /dev/sdb1 /dev/sdc1
激活新添加的音量组 (Activate the new added volume group)
We can activeate it by scan the volume groups:
我们可以通过扫描卷组来激活它:
# vgscan
将新的物理卷添加到卷组 (Add new physical volumes to the volume group)
If we installed another hard disk /dev/sdd afterwards, we can create partition /dev/sdd1 on it and initialize it as introduced above. Then we can add the new physical volume to the volume group:
如果之后再安装另一个硬盘/ dev / sdd,则可以在其上创建分区/ dev / sdd1并按照上面的介绍对其进行初始化。 然后,我们可以将新的物理卷添加到卷组中:
# vgextend vg_xen /dev/sdd1
A more detailed tutorial of extending a LVM volume group can be found here: Extending a LVM Volume Group.
更详细的教程的延伸的LVM卷组可以在这里找到: 扩展LVM卷组 。
翻译自: https://www.systutorials.com/creating-lvm-volume-group/