实验01 创建逻辑卷
实验目标
从两块磁盘上各取10GB组成20GB的卷组
从卷组中划分一个16GB的逻辑卷
将此逻辑卷格式化并挂载到/mbox
实验步骤
一、为新添加的两块硬盘分区
[[email protected] ~]# fdisk -l | grep LVM //查看标记为LVM的分区
/dev/sdb1 1 1217 9775521 8e Linux LVM
/dev/sdc1 1 1217 9775521 8e Linux LVM
二、创建物理卷pvcreate 分区 分区
[[email protected]~]# pvscan //扫描物理卷
No matching physical volumes found
[[email protected]~]# pvdisplay //显示物理卷
[[email protected]~]# pvcreate /dev/sdb1 /dev/sdc1 //创建物理卷
Writing physical volume data to disk"/dev/sdb1"
Physical volume "/dev/sdb1"successfully created
Writing physical volume data to disk"/dev/sdc1"
Physical volume "/dev/sdc1"successfully created
[[email protected]~]# pvscan
PV /dev/sdb1 lvm2 [9.32 GB]
PV /dev/sdc1 lvm2 [9.32 GB]
Total: 2 [18.65 GB] / in use: 0 [0 ] / in no VG: 2 [18.65 GB]
[[email protected]~]# pvdisplay
"/dev/sdb1" is a new physicalvolume of "9.32 GB"
--- NEW Physical volume ---
PV Name /dev/sdb1
VG Name
PV Size 9.32 GB
Allocatable NO
PE Size (KByte) 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID jpuMRT-9Xwr-bEKm-Edc1-qhsb-oDiG-AUf5w9
"/dev/sdc1" is a new physicalvolume of "9.32 GB"
--- NEW Physical volume ---
PV Name /dev/sdc1
VG Name
PV Size 9.32 GB
Allocatable NO
PE Size (KByte) 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID Bkr2nc-yclE-0j1K-UE99-2Pnd-3BaV-wyrqhm
三、创建卷组vgcreate 卷组名 分区 分区
[[email protected]~]# vgscan //扫描卷组
Reading all physical volumes. This may take a while...
No volume groups found
[[email protected]~]# vgdisplay //显示卷组
No volume groups found
[[email protected]~]# vgcreate vg_data /dev/sd{b,c}1 //创建指定名称的卷组
Volume group "vg_data" successfullycreated
[[email protected]~]# vgscan
Reading all physical volumes. This may take a while...
Found volume group "vg_data" usingmetadata type lvm2
[[email protected]~]# vgdisplay
--- Volume group ---
VG Name vg_data
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 2
Act PV 2
VG Size 18.64 GB
PE Size 4.00 MB
Total PE 4772
Alloc PE / Size 0 / 0
Free PE / Size 4772 / 18.64 GB
VG UUID pA9c9b-hNEB-emWv-c5am-lRgv-rAmf-Ff4egw
四、创建逻辑卷lvcreate -L 大小 -n 逻辑卷名 卷组名
[[email protected]~]# lvscan //扫描逻辑卷
[[email protected]~]# lvdisplay //显示逻辑卷
[[email protected]~]# lvcreate -L 16G -nlv_mbox vg_data //创建指定大小和名称
的逻辑卷
Logical volume "lv_mbox" created
[[email protected]~]# lvscan
ACTIVE '/dev/vg_data/lv_mbox' [16.00 GB]inherit
[[email protected]~]# lvdisplay
--- Logical volume ---
LV Name /dev/vg_data/lv_mbox
VG Name vg_data
LV UUID fB0Kr6-r03Z-YuNu-Kq75-uEdY-D4oW-OluAGl
LV Write Access read/write