Resizing partition fdisk fails with invalid argument
Solution 1:
I managed to solve this rather simply. I installed parted and when I ran that it informed me that the partition table didn't cover the full disk (duh), so it asked me Fix/Cancel
to which I responded with Fix
. Apparently, that did the trick as I was able to modify the partition to the full size using sudo fdisk /dev/vda
, but afterwards I did need to run sudo resize2fs /dev/vda3
to have the changes applied.
Solution 2:
The problem is that the protective MBR (PMBR) is too small. You can change the protective MBR using:
x
for extra functionalityM
to enter protective/hybrid MBR- (
p
allows to show the protective MBR) r
to return to main menu (still in protective MBR mode!)d
to delete the wrongly sized protective MBR partitionn
to create a new partition and 4xenter to accept defaults settings (primary, partition number 1 and full size)t
andee
to change type to GPTx
for extra functionalityM
to leave protective/hybrid MBR moder
to return to main menu (now in GPT mode again)w
to write
With that I could fix the GPT PMBR size mismatch.
To fix the disklabel issue I had to dump the partition table using O
and change last-lba in the exported script to the disksize as reported in fdisk
, minus 34 (for secondary GPT). I then reimported the script using I
.