resize hdd for a KVM guest

tincboy

Renowned Member
Apr 13, 2010
466
6
83
I've a running website on a KVM guest that is built with Proxmox, but now I need to expand the hdd,
What's the best practice of resizing a Centos box on a KVM guest?
 
I've a running website on a KVM guest that is built with Proxmox, but now I need to expand the hdd,
What's the best practice of resizing a Centos box on a KVM guest?
Hi,
if you use lvm inside the guest, add a second hdd and add this hdd to the volumegroup. After that you can extend your logical volumes.

You can also extend your hdd-file (if in raw-format). Search for "dd + seek" in this forum.

Udo
 
Hi,
if you use lvm inside the guest, add a second hdd and add this hdd to the volumegroup. After that you can extend your logical volumes.

You can also extend your hdd-file (if in raw-format). Search for "dd + seek" in this forum.

Udo
I don't know if it's on a lvm, I've installed Centos normally,
 
vgdisplay
--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 24.88 GB
PE Size 32.00 MB
Total PE 796
Alloc PE / Size 796 / 24.88 GB
Free PE / Size 0 / 0
VG UUID neLtgB-9Aks-uxtR-0oz1-KDH9-ACVl-TQ9jqM

Does it means I can resize the partiotion?
 
vgdisplay
--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 24.88 GB
PE Size 32.00 MB
Total PE 796
Alloc PE / Size 796 / 24.88 GB
Free PE / Size 0 / 0
VG UUID neLtgB-9Aks-uxtR-0oz1-KDH9-ACVl-TQ9jqM

Does it means I can resize the partiotion?
Yes - if the part for which you need more space is on the volume group. This should show mount - or lvdisplay.
If you add a second harddisk (i.e. /dev/sdb) you can add the whole harddisk with
Code:
pvcreate /dev/sdb
vgextend VolGroup00 /dev/sdb
You can also use a partition (sdb1 with type 8e) but is only usefull to remind, that sdb is not empty!
After that you see a new value at Free PE in the vgdisplay output.
Than lvextend and resize2fs (if the filesystem is an ext-fs).
Look also at the man-pages ;-)

Udo
 
Thank you Udo,
I've added a new HDD to VM but even after reboot centos didn't recognize it and there's no /dev/hdb
what type of HDD does Centos recognize automatically?
 
Hi,
you must switch of the vm and start again. A reboot is not enough - the bios know only the old drives.

Udo
I've successfully resized the VolGroup00 but df -h again shows the same size,