Extend Linux hard disk

Arcanes06

New Member
Nov 6, 2017
5
0
1
34
Hi all,

I'm working on PVE 5.1 and i get some issues when i want to extend a linux virtual machine hard disk.
I'm working with LVM on the proxmox node.
For example I extend by 10G a scsi drive on a VM.

I see the change on the sda disk when i run
# dmesg
But i can't extend the root partition of the VM by using parted, pvextend, pvresize, fdisk or something else.

Is there a simple way to extend root partition after adding some disk space on a VM?

Thank you in advance
 
If the VM installation also has an lvm, you have to do this within the VM as well:
  • Extend LVM
  • Extend Partition
 
Yes the vm has. But it doesn't work for me.
Can you please tell me the procedure after adding some disk space?
 
Boot the VM with a Live CD like Ubuntu-Live CD.

Extend LVM with a GUI:
  1. sudo add-apt-repository universe
  2. sudo apt-get install system-config-lvm
  3. system-config-lvm
Extend the LVM with that GUI. If you cannot change the lvm you may have to do this: sudo vgchange -ay.

Once the LVM is extended, use Gparted (also GUI) to extend the partition.
 
Using fdisk (or cfdisk or gdisk if it's gpt) /dev/sdX from inside the VM, can you see the free space at the end of the disk?
In that case you can:
- partition that space
- pvcreate /dev/sdXn on the new partition
- then vgextend vg /dev/sdXn (vg is the name of the volume group you want to extend)
- in the end lvresize -r -l +100%FREE vg

It should work