Increase size to my CentOS7

General support questions
Post Reply
jvr968
Posts: 6
Joined: 2019/06/11 15:55:20

Increase size to my CentOS7

Post by jvr968 » 2020/01/14 23:06:21

Hello.
I have a Virtual Machine with CentOS7 system installed in virtual Machine Manager with 20GB of space.
I want to resize the VM to 40GB
I increased the VM disk with:
qemu-img resize centos7.qcow2 +20G

Now I have:

[root@eos ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda 252:0 0 40G 0 disk
├─vda1 252:1 0 1G 0 part /boot
└─vda2 252:2 0 19G 0 part
├─centos-root 253:0 0 17G 0 lvm /
└─centos-swap 253:1 0 2G 0 lvm [SWAP]


[root@eos ~]# pvs
File descriptor 6 (/dev/pts/0) leaked on pvs invocation. Parent PID 2659: -bash
PV VG Fmt Attr PSize PFree
/dev/vda2 centos lvm2 a-- <19.00g 0
[root@eos ~]# vgs
File descriptor 6 (/dev/pts/0) leaked on vgs invocation. Parent PID 2659: -bash
VG #PV #LV #SN Attr VSize VFree
centos 1 2 0 wz--n- <19.00g 0
[root@eos ~]# lvs
File descriptor 6 (/dev/pts/0) leaked on lvs invocation. Parent PID 2659: -bash
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root centos -wi-ao---- <17.00g
swap centos -wi-ao---- 2.00g


How do I increase a KVM guest's disk space?

Thank you.

User avatar
jlehtone
Posts: 2482
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Increase size to my CentOS7

Post by jlehtone » 2020/01/15 09:06:54


hunter86_bg
Posts: 1971
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: Increase size to my CentOS7

Post by hunter86_bg » 2020/01/15 09:50:17

Simplest way is to create a new primary partition (if you use MBR) and then make this new partition PV and this pv can be added to the VG.

Before doing things like that, you can create a snapshot.

Something like this:

Code: Select all

fdisk /dev/vda->n->p->3->Enter->Enter->t->3->8e-> w
partprobe /dev/vda
pvcreate /dev/vda3
vgextend centos /dev/vda3
lvextend -r -l 100%FREE /dev/centos/root

hunter86_bg
Posts: 1971
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: Increase size to my CentOS7

Post by hunter86_bg » 2020/01/15 11:46:15

Or a more safer approach (for next time) -> just add a new disk and use that (unpartitioned) for a PV.

jvr968
Posts: 6
Joined: 2019/06/11 15:55:20

Re: Increase size to my CentOS7

Post by jvr968 » 2020/01/15 17:11:39

Thank you

Post Reply

Return to “CentOS 7 - General Support”