pvcreate /dev/sdb /dev/sdc /dev/sdd /dev/sde


vgcreate datavg /dev/sdb 数据盘 200
vgcreate archvg /dev/sdc 归档 200
vgcreate backvg /dev/sdd 备份盘 400
vgcreate oravg /dev/sde oracle安装目录 50

lvcreate -n oralv -L 50000M oravg
lvcreate -n datalv -L 200000M datavg
lvcreate -n backuplv -L 400000M backvg
lvcreate -n archlv -L 200000M archvg


删除lv
lvremove命令 用于删除指定LVM逻辑卷。如果逻辑卷已经使用mount命令加载,则不能使用lvremove命令删除。必须使用umount命令卸载后,逻辑卷方可被删除。

-f:强制删除。

[root@life1 ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
backuplv backvg -wi-a----- 195.31g
oralv oravg -wi-a----- <48.83g
root rhel -wi-ao---- <17.00g
swap rhel -wi-a----- 2.00g
[root@life1 ~]# lvremove /dev/oravg/oralv
Do you really want to remove active logical volume oravg/oralv? [y/n]: y
Logical volume "oralv" successfully removed
[root@life1 ~]# lvremove /dev/backvg/backuplv
Do you really want to remove active logical volume backvg/backuplv? [y/n]: y
Logical volume "backuplv" successfully removed

 


删除vg
vgremove命令 用于用户删除LVM卷组。当要删除的卷组上已经创建了逻辑卷时,vgremove命令需要进行确认删除,防止误删除数据。

-f:强制删除。
[root@life1 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
backvg 1 0 0 wz--n- <200.00g <200.00g
oravg 1 0 0 wz--n- <200.00g <200.00g
rhel 1 2 0 wz--n- <19.00g 0
[root@life1 ~]# vgremove backvg
Volume group "backvg" successfully removed
[root@life1 ~]# vgremove oravg
Volume group "oravg" successfully removed


删除pv
[root@life1 ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 rhel lvm2 a-- <19.00g 0
/dev/sdb lvm2 --- 200.00g 200.00g
/dev/sdc lvm2 --- 200.00g 200.00g
/dev/sdd lvm2 --- 400.00g 400.00g
/dev/sde lvm2 --- 50.00g 50.00g
[root@life1 ~]# pvre
pvremove pvresize
[root@life1 ~]# pvremove /dev/sdb
Labels on physical volume "/dev/sdb" successfully wiped.
[root@life1 ~]# pvremove /dev/sdc
Labels on physical volume "/dev/sdc" successfully wiped.
[root@life1 ~]# pvremove /dev/sdd
Labels on physical volume "/dev/sdd" successfully wiped.
[root@life1 ~]# pvremove /dev/sde
Labels on physical volume "/dev/sde" successfully wiped.
----


创建lvm


[root@life1 ~]# pvcreate /dev/sdb /dev/sdc /dev/sdd
Physical volume "/dev/sdb" successfully created.
Physical volume "/dev/sdc" successfully created.
Physical volume "/dev/sdd" successfully created.
[root@life1 ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 rhel lvm2 a-- <19.00g 0
/dev/sdb lvm2 --- 200.00g 200.00g
/dev/sdc lvm2 --- 200.00g 200.00g
/dev/sdd lvm2 --- 400.00g 400.00g
[root@life1 ~]# vgcreate oravg /dev/sdb
Volume group "oravg" successfully created
[root@life1 ~]# vgcreate backvg /dev/sdc
Volume group "backvg" successfully created
[root@life1 ~]# vgcreate archvg /dev/sdd
Volume group "archvg" successfully created
[root@life1 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
archvg 1 0 0 wz--n- <400.00g <400.00g
backvg 1 0 0 wz--n- <200.00g <200.00g
oravg 1 0 0 wz--n- <200.00g <200.00g
rhel 1 2 0 wz--n- <19.00g 0
[root@life1 ~]# pvcreate /dev/sde
Physical volume "/dev/sde" successfully created.
[root@life1 ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 rhel lvm2 a-- <19.00g 0
/dev/sdb oravg lvm2 a-- <200.00g <200.00g
/dev/sdc backvg lvm2 a-- <200.00g <200.00g
/dev/sdd archvg lvm2 a-- <400.00g <400.00g
/dev/sde lvm2 --- 50.00g 50.00g
[root@life1 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
archvg 1 0 0 wz--n- <400.00g <400.00g
backvg 1 0 0 wz--n- <200.00g <200.00g
oravg 1 0 0 wz--n- <200.00g <200.00g
rhel 1 2 0 wz--n- <19.00g 0
[root@life1 ~]# vgremove archvg
Volume group "archvg" successfully removed
[root@life1 ~]# vgremove backvg
Volume group "backvg" successfully removed
[root@life1 ~]# vgremove oravg
Volume group "oravg" successfully removed
[root@life1 ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 rhel lvm2 a-- <19.00g 0
/dev/sdb lvm2 --- 200.00g 200.00g
/dev/sdc lvm2 --- 200.00g 200.00g
/dev/sdd lvm2 --- 400.00g 400.00g
/dev/sde lvm2 --- 50.00g 50.00g
[root@life1 ~]#
[root@life1 ~]#
[root@life1 ~]# vgcreate datavg /dev/sdb
Volume group "datavg" successfully created
[root@life1 ~]# vgcreate archvg /dev/sdc
Volume group "archvg" successfully created
[root@life1 ~]# vgcreate backvg /dev/sdd
Volume group "backvg" successfully created
[root@life1 ~]# vgcreate oravg /dev/sde
Volume group "oravg" successfully created
[root@life1 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
archvg 1 0 0 wz--n- <200.00g <200.00g
backvg 1 0 0 wz--n- <400.00g <400.00g
datavg 1 0 0 wz--n- <200.00g <200.00g
oravg 1 0 0 wz--n- <50.00g <50.00g
rhel 1 2 0 wz--n- <19.00g 0
[root@life1 ~]# lvcreate -n oralv -L 50000M oravg
Logical volume "oralv" created.
[root@life1 ~]# lvcreate -n datalv -L 200000M datavg
Logical volume "datalv" created.
[root@life1 ~]# lvcreate -n backuplv -L 400000M backvg
Logical volume "backuplv" created.
[root@life1 ~]# lvcreate -n archlv -L 200000M archvg
Logical volume "archlv" created.
[root@life1 ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
archlv archvg -wi-a----- 195.31g
backuplv backvg -wi-a----- 390.62g
datalv datavg -wi-a----- 195.31g
oralv oravg -wi-a----- <48.83g
root rhel -wi-ao---- <17.00g
swap rhel -wi-a----- 2.00g