I'm launching a virtual machine with QEMU/KVM. After resizing the qcow2 disk image via
qemu-img resize Test.qcow2 +500M
And looking at the instance disk via:
fdisk -l
inside the instance, I can see the following warning message:
GPT PMBR size mismatch (17752063 != 19800063) will be corrected by w(rite).
I would like to write a script that automatically resize the partition to take up the maximal space available following the disk resize and then resize the file system. It looks like I need to fix this previous warning message first.
I successfully fixed that interactively via the parted utility, but I would like to do this in an automated way, something like:
- Fix the GPT PMBR size mismatch.
- Extend the partition.
- Extend the filesystem.
The parted utility has a --script flag but it doesn't help here since when this option is active, the parted utility simply skips the fix part and only output the partition table.
Number 2. and 3. are working fine. How can I automate number 1 (i.e. without prompting for any end user interaction ?)