1

I had a virtual machine which had no space left on my server using Proxmox Hypervisor.

I used this command to add 5Go of space to the VM putting the max space to 15Go:

qm resize <vmid> <device> <incrementsize>
qm resize 110 scsi0 +5

As you can see on the figure below, I have my 15 Go of space. But it's not allocated to the partition sda2.

Sample

Then my question is, how to resize this sda2 partition without recreating it from scratch ?

Thank you

EDIT :

sudo resize2fs /dev/sda2

Resizing the filesystem doesn't work because my partition is of type LVM.

LuckyFr
  • 143

1 Answers1

1

This might seem scary but it's safe. First, open a tmux or screen; you do not want to do that over a session that might go down due to a network glitch. Second, run fdisk -l /dev/sda and copy somewhere the output. It will be something like this:

enter image description here

Get a snapshot of it with your mobile, put it on paper, but copy it. Then the tricky part. You want to delete sda2 and recreate it with the same starting sector and a higher ending sector, or just hit enter and it will be extended to the end of the available space. If needed change its type to the partition type listed under the Type column of whatever fdisk -l /dev/sda's output says. An example session would be like the following:

enter image description here

In this case the disk is vda and the partition vda1, but the procedure is the same. All you need to do next, is extend the file system, which you will accomplish with the appropriate tool for the file system you're using.

gmelis
  • 697