LVM作为操作非常灵活的磁盘操作模式,还是有必要熟练的。
ENV:
[root@centos7 ~]# uname -r
3.10.0-514.el7.x86_64
[root@centos7 ~]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
[root@centos7 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 5G 0 disk
sdb 8:16 0 5G 0 disk
sdc 8:32 0 5G 0 disk
sdd 8:48 0 5G 0 disk
sde 8:64 0 5G 0 disk
sdf 8:80 0 5G 0 disk
sdg 8:96 0 5G 0 disk
sdh 8:112 0 8G 0 disk
├─sdh1 8:113 0 1G 0 part /boot
└─sdh2 8:114 0 7G 0 part
├─cl-root 253:0 0 6.2G 0 lvm /
└─cl-swap 253:1 0 820M 0 lvm [SWAP]
sr0 11:0 1 1024M 0 rom
上面的ENV为系统环境,为了操作LVM,下面还要进行卷操作,以加深操作。
整个过程为PVcreate->VGcreate—>LVcreate:
[root@centos7 ~]# pvcreate /dev/sda
Physical volume "/dev/sda" successfully created.
[root@centos7 ~]# pvcreate /dev/sdb
Physical volume "/dev/sdb" successfully created.
[root@centos7 ~]# vgcreate vgsys /dev/sda /dev/sdb
Volume group "vgsys" successfully created
[root@centos7 ~]# vgdisplay
--- Volume group ---
VG Name vgsys
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 9.99 GiB
PE Size 4.00 MiB
Total PE 2558