Show Table of Contents
5.2. 创建条带逻辑卷
本示例为创建一个名为
striped_logical_volume 的条带逻辑卷,并可在磁盘 /dev/sda1、/dev/sdb1 和 /dev/sdc1 间跨磁盘条带分配数据。
5.2.1. 创建物理卷
将卷组中要使用的磁盘标记为 LVM 物理卷。
警告
这个命令会破坏
/dev/sda1、/dev/sdb1 和/dev/sdc1 中的所有数据。
# pvcreate /dev/sda1 /dev/sdb1 /dev/sdc1
Physical volume "/dev/sda1" successfully created
Physical volume "/dev/sdb1" successfully created
Physical volume "/dev/sdc1" successfully created5.2.2. 创建卷组
以下命令可创建卷组
volgroup01。
# vgcreate volgroup01 /dev/sda1 /dev/sdb1 /dev/sdc1
Volume group "volgroup01" successfully created
可以使用
vgs 命令显示新卷组的属性。
# vgs
VG #PV #LV #SN Attr VSize VFree
volgroup01 3 0 0 wz--n- 51.45G 51.45G5.2.3. 创建逻辑卷
以下命令可使用卷组
volgroup01 创建条带逻辑卷 striped_logical_volume。本示例创建的逻辑卷的大小为 2GB,有三个条带,每个条带的大小为 4Kb。
# lvcreate -i 3 -a I 4 -L 2 G -nstriped_logical_volume volgroup01
Rounding size (512 extents) up to stripe boundary size (513 extents)
Logical volume "striped_logical_volume" created5.2.4. 创建文件系统
下面的命令在逻辑卷中创建了一个 GFS2 文件系统。
#mkfs.gfs2 -plock_nolock -j 1 /dev/volgroup01/striped_logical_volumeThis will destroy any data on /dev/volgroup01/striped_logical_volume. Are you sure you want to proceed? [y/n]yDevice: /dev/volgroup01/striped_logical_volume Blocksize: 4096 Filesystem Size: 492484 Journals: 1 Resource Groups: 8 Locking Protocol: lock_nolock Lock Table: Syncing... All Done
下面的命令将挂载逻辑卷并报告文件系统磁盘空间用量。
#mount /dev/volgroup01/striped_logical_volume /mnt[root@tng3-1 ~]#dfFilesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/VolGroup00-LogVol00 13902624 1656776 11528232 13% / /dev/hda1 101086 10787 85080 12% /boot tmpfs 127880 0 127880 0% /dev/shm /dev/volgroup01/striped_logical_volume 1969936 20 1969916 1% /mnt

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.