前序步骤请参考:《VMware虚拟机中CentOS根分区的扩展》
当执行完:vgextend步骤以后,用vgdisplay检查未分配磁盘,发现:
Free PE / Size 535 / <2.09 GiB
[root@testhost oracle]# vgdisplay
--- Volume group ---
VG Name centos
System ID
Format lvm2
Metadata Areas 3
Metadata Sequence No 6
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 3
Act PV 3
VG Size <60.99 GiB
PE Size 4.00 MiB
Total PE 15613
Alloc PE / Size 15078 / <58.90 GiB
Free PE / Size 535 / <2.09 GiB
VG UUID oa6Dva-ITGg-zjjQ-AYTj-QLPf-ocln-Ysnga1
然后用lvextend 步骤去分配。(resize2fs及其后续步骤就不用做了)
分配完成用free命令查看,会发现swap并未增加。
[root@testhost oracle]# free
total used free shared buff/cache available
Mem: 1867024 666192 683220 10268 517612 1001352
Swap: 2097148 0 2097148
此时需要重置Swap:
[root@testhost oracle]# swapoff /dev/centos/swap
[root@testhost oracle]# mkswap /dev/centos/swap
mkswap: /dev/centos/swap: warning: wiping old swap signature.
Setting up swapspace version 1, size = 3145724 KiB
no label, UUID=664b4586-5777-4f2d-8bfd-ab1c6ba5bd64
[root@testhost oracle]# swapon /dev/centos/swap
这些完成后再看,就成功了。
[root@testhost oracle]# free
total used free shared buff/cache available
Mem: 1867024 666936 683416 10268 516672 1000624
Swap: 3145724 0 3145724