大家好,又见面了,我是你们的朋友全栈君。
接上所写
二、LVM扩容(本次扩容需要对pv,vg,lv等进行扩容)
需求分析:
/ora01需要扩容5G
(1)查看所需扩容的/ora01的空间情况[root@db01 test]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 45G 4.4G 39G 11% /
tmpfs 1004M 0 1004M 0% /dev/shm
/dev/sda1 485M 39M 421M 9% /boot
/dev/sdb2 79G 184M 75G 1% /oracle
/dev/sdb1 20G 172M 19G 1% /soft
/dev/sdd1 1007M 18M 939M 2% /alexpeng
/dev/mapper/oraclevg-lvoracle 2.0G 68M 1.9G 4% /ora01
(2)查看当前vg大小,空闲空间小于5G[root@db01 test]# vgs
VG #PV #LV #SN Attr VSize VFree
oraclevg 3 1 0 wz–n- 5.99g 3.99g
[root@db01 /]# vgdisplay
— Volume group —
VG Name oraclevg
System ID
Format lvm2
Metadata Areas 3
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 3
Act PV 3
VG Size 5.99 GiB
PE Size 4.00 MiB
Total PE 1533
Alloc PE / Size 512 / 2.00 GiB
Free PE / Size 1021 / 3.99 GiB
VG UUID izNwjZ-XBiO-UVVl-y3H6-kvM4-gFUy-CXiaD1
(3)加载磁盘,并查看磁盘情况[root@db01 /]# fdisk -l |grep “Disk /dev/sd”
WARNING: GPT (GUID Partition Table) detected on ‘/dev/sdd’! The util fdisk doesn’t support GPT. Use GNU Parted.’
Disk /dev/sda: 53.7 GB, 53687091200 bytes
Disk /dev/sdb: 107.4 GB, 107374182400 bytes
Disk /dev/sdc: 107.4 GB, 107374182400 bytes
Disk /dev/sdd: 1073 MB, 1073741824 bytes
Disk /dev/sde: 2147 MB, 2147483648 bytes
Disk /dev/sdf: 2147 MB, 2147483648 bytes
Disk /dev/sdg: 2147 MB, 2147483648 bytes
Disk /dev/sdh: 2147 MB, 2147483648 bytes
(4)将新添加的磁盘加入物理卷中
说明:添加整个磁盘到PV,可以不用分区不用格式化。如果添加分区到PV,需要用之前讲的fdisk或parted分区。[root@db01 /]# pvcreate /dev/sdh
Physical volume “/dev/sdh” successfully created
[root@db01 /]#
[root@db01 /]# pvs
PV VG Fmt Attr PSize PFree
/dev/sde oraclevg lvm2 a– 2.00g 0
/dev/sdf oraclevg lvm2 a– 2.00g 1.99g
/dev/sdg oraclevg lvm2 a– 2.00g 2.00g
/dev/sdh lvm2 a– 2.00g 2.00g
(5)将新建物理卷对卷组进行扩容[root@db01 /]# vgextend oraclevg /dev/sdh
Volume group “oraclevg” successfully extended
[root@db01 /]#
[root@db01 /]# vgs
VG #PV #LV #SN Attr VSize VFree
oraclevg 4 1 0 wz–n- 7.98g 5.98g
(6)在卷组上对逻辑卷进行扩容[root@db01 /]# lvs
LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert
lvoracle oraclevg -wi-ao—- 2.00g
[root@db01 /]# lvextend -L +5G /dev/oraclevg/lvoracle ###在lvoracle上扩容5G
Extending logical volume lvoracle to 7.00 GiB
Logical volume lvoracle successfully resized
[root@db01 /]#
[root@db01 /]#
[root@db01 /]# lvs
LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert
lvoracle oraclevg -wi-ao—- 7.00g
(7)重新设置LV的文件系统大小[root@db01 /]# resize2fs /dev/oraclevg/lvoracle
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/oraclevg/lvoracle is mounted on /ora01; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/oraclevg/lvoracle to 1835008 (4k) blocks.
The filesystem on /dev/oraclevg/lvoracle is now 1835008 blocks long.
(8)检查逻辑卷扩容是否已经加载[root@db01 /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 45G 4.4G 39G 11% /
tmpfs 1004M 0 1004M 0% /dev/shm
/dev/sda1 485M 39M 421M 9% /boot
/dev/sdb2 79G 184M 75G 1% /oracle
/dev/sdb1 20G 172M 19G 1% /soft
/dev/sdd1 1007M 18M 939M 2% /alexpeng
/dev/mapper/oraclevg-lvoracle 6.9G 69M 6.5G 2% /ora01
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/151509.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...