Resize Disk on a VM

vikozo

Renowned Member
May 4, 2014
783
32
93
suisse
www.wombat.ch
hello
i have a VM which i had to resize the Disk so i did add 25G up to now 35Gig.
stop and start the vm and boot into gparted

1664131243463.png

the Problem

i can't resize it
1664131297763.png
so what did i wrong

have a nice day
vinc
 
The extended partition is in the way. The extended partition can contain other (non-bootable) partitions and was often used in the past because a MBR could only have 4 primary partitions. You first need to shrink/move the light-blue partition (sda2, which contains sda5) before you can grow sda1.
 
Maybe you need to move sda5 (swap) to the front of sda2 (extended) first? Or maybe it's a rounding issue and just leave 1 MB of space here or there.
Or just remove sda5 and sda2, resize sda1 and add a new swap partition. But you'll need to adjust the operating system inside the VM for the new UUID and/or partition number of the swap.

EDIT: There are probably better tutorials on the internet about this than I can explain here. It's not really a virtualization thing as this mostly applies to real drives.
 
Last edited:
I usually put the swap partition at the beginning to prevent such issues when resizing later. If you don't need more than 4 partitions, the extended partition is not needed.
I suggest you just remove sda5 and sda2, resize sda1 and add a new swap partition. But you'll need to adjust the operating system inside the VM for the new UUID and/or partition number of the swap.
 
As long as you have (several) backups, feel free to try different solutions.Personally, I found that running regular background backups with PBS can prevent a lot of stress.