Resize LVM of VPS inside LVM of Proxmox host

Fullmetal

New Member
Jul 24, 2018
2
0
1
35
Hello everyone,

i am kind of a noob when it comes to disks and resizing so i would very much appreciate some help.

First we have the proxmox host that has a 476GB Volume Group, vg0. This Volume Group consists of 3 Logical volumes that consist of the hosts swap, root and the VM Disk.

Total usage is 436GB.

Now inside the VM i made a mistake when setting it up and my /root partition is getting close to 100%. Since The host uses 436/476GB of the Volume group i would like to use that space for the /root partition.

What i have done so far is the following command on the host to extend the Logical volume of the VPS:

lvextend -l +100%FREE /dev/vg0/vm-100-disk-1

My lvdisplay on the Proxmox Host now is as follows:

lvdisplay
--- Logical volume ---
LV Path /dev/vg0/root
LV Name root
VG Name vg0
LV UUID PW9UWy-MBFh-Eses-2ZuK-AMzm-2F75-04otIb
LV Write Access read/write
LV Creation host, time rescue, 2017-11-17 17:10:11 +0100
LV Status available
# open 1
LV Size 10.00 GiB
Current LE 2560
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0

--- Logical volume ---
LV Path /dev/vg0/swap
LV Name swap
VG Name vg0
LV UUID uBv0p6-WJ3D-c5rj-lCqn-VXzA-QrRY-rAhxc3
LV Write Access read/write
LV Creation host, time rescue, 2017-11-17 17:10:12 +0100
LV Status available
# open 2
LV Size 6.00 GiB
Current LE 1536
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1

--- Logical volume ---
LV Path /dev/vg0/vm-100-disk-1
LV Name vm-100-disk-1
VG Name vg0
LV UUID Kt2lnu-neHi-3k2V-bRe1-esHw-Oh8d-a6TR7N
LV Write Access read/write
LV Creation host, time Proxmox-VE, 2017-11-17 17:38:47 +0100
LV Status available
# open 1
LV Size 460.31 GiB
Current LE 117839
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2

When i log in the VM the space is of course not allocated yet. My question is what other steps do i need to take to make this work?

Thank you for your time.
 
Depends on your guest but in general:
- rescan for changed settings on disks
- change filesystem size

Hello,

thank you for your reply. The output of /etc/fstab inside the VM is the following

/dev/mapper/centos-root / xfs defaults,uquota 0 0
UUID=3a25a1fb-24bb-43d2-8098-2ad27ada67d3 /boot xfs defaults 0 0
/dev/mapper/centos-home /home xfs defaults,uquota 0 0
/dev/mapper/centos-swap swap swap defaults 0 0

I understand i can resize the root partition with the use of xfs_growfs. Are there any actions i need to take first on the host to complete the extend of the Logical volume /dev/vg0/vm-100-disk-1 ?
 
Last edited:
I understand i can resize the root partition with the use of xfs_growfs
It the underlying logical volume has been resized, yes.

Are there any actions i need to take first on the host to complete the extend of the Logical volume /dev/vg0/vm-100-disk-1 ?

You manually changed it without using the PVE interface. I assume you need to change the harddisk settings in PVE manually in the vm configration in /etc/pve/qemu-server/<vmid>.conf.

In your guest, you have LVM, so you need to change the partition table, physical volume, then the logical volume you want to give more space to and finally the filesystem itself.

I can strongly recommend for future installations to separate the OS from DATA and use different virtual disks. The data disk should be used:
a) if LVM is used, do not use a partition table for one single physical volume, use the blockdevice itself
b) if no LVM should be used, use the blockdevice directly for the filesystem
You end up in a VM friendly setup in which you have the fewest possible changes if you resize your virtual disks.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!