Root partition not automatically growing
The cloud image's root partition doesn't automatically grow on first boot:
% lsblk /dev/vda
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
vda 254:0 0 3G 0 disk
├─vda1 254:1 0 1M 0 part
├─vda2 254:2 0 300M 0 part /efi
└─vda3 254:3 0 1.7G 0 part /
This is because cloud-init's growpart fails with the following message:
no tools available to resize disk with 'gpt'
/var/log/cloud-init.log
2023-06-24 13:07:05,522 - modules.py[DEBUG]: Running module growpart (<module 'cloudinit.config.cc_growpart' from '/usr/lib/python3.11/site-packages/cloudinit/config/cc_growpart.py'>) with frequency always
2023-06-24 13:07:05,522 - handlers.py[DEBUG]: start: init-network/config-growpart: running config-growpart with frequency always
2023-06-24 13:07:05,522 - helpers.py[DEBUG]: Running config-growpart using lock (<cloudinit.helpers.DummyLock object at 0x7f77d89cd850>)
2023-06-24 13:07:05,522 - cc_growpart.py[DEBUG]: No 'growpart' entry in cfg. Using default: {'mode': 'auto', 'devices': ['/'], 'ignore_growroot_disabled': False}
2023-06-24 13:07:05,522 - subp.py[DEBUG]: Running command ['growpart', '--help'] with allowed return codes [0] (shell=False, capture=True)
2023-06-24 13:07:05,538 - util.py[DEBUG]: Reading from /proc/334/mountinfo (quiet=False)
2023-06-24 13:07:05,538 - util.py[DEBUG]: Read 2986 bytes from /proc/334/mountinfo
2023-06-24 13:07:05,538 - util.py[DEBUG]: Reading from /sys/class/block/vda3/partition (quiet=False)
2023-06-24 13:07:05,538 - util.py[DEBUG]: Read 2 bytes from /sys/class/block/vda3/partition
2023-06-24 13:07:05,538 - util.py[DEBUG]: Reading from /sys/devices/pci0000:00/0000:00:05.0/virtio2/block/vda/dev (quiet=False)
2023-06-24 13:07:05,538 - util.py[DEBUG]: Read 6 bytes from /sys/devices/pci0000:00/0000:00:05.0/virtio2/block/vda/dev
2023-06-24 13:07:05,539 - util.py[DEBUG]: Reading from /proc/334/mountinfo (quiet=False)
2023-06-24 13:07:05,539 - util.py[DEBUG]: Read 2986 bytes from /proc/334/mountinfo
2023-06-24 13:07:05,539 - util.py[DEBUG]: Reading from /proc/334/mountinfo (quiet=False)
2023-06-24 13:07:05,539 - util.py[DEBUG]: Read 2986 bytes from /proc/334/mountinfo
2023-06-24 13:07:05,539 - subp.py[DEBUG]: Running command ['growpart', '--dry-run', '/dev/vda', '3'] with allowed return codes [0] (shell=False, capture=True)
2023-06-24 13:07:05,563 - util.py[WARNING]: Failed growpart --dry-run for (/dev/vda, 3)
2023-06-24 13:07:05,563 - util.py[DEBUG]: Failed growpart --dry-run for (/dev/vda, 3)
Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/cloudinit/config/cc_growpart.py", line 196, in resize
subp.subp(
File "/usr/lib/python3.11/site-packages/cloudinit/subp.py", line 335, in subp
raise ProcessExecutionError(
cloudinit.subp.ProcessExecutionError: Unexpected error while running command.
Command: ['growpart', '--dry-run', '/dev/vda', '3']
Exit code: 2
Reason: -
Stdout: FAILED: failed to get a resizer for format 'gpt'
Stderr: no tools available to resize disk with 'gpt'
2023-06-24 13:07:05,564 - util.py[DEBUG]: resize_devices took 0.026 seconds
2023-06-24 13:07:05,564 - cc_growpart.py[DEBUG]: '/' FAILED: failed to resize: disk=/dev/vda, ptnum=3: Unexpected error while running command.
Command: ['growpart', '--dry-run', '/dev/vda', '3']
Exit code: 2
Reason: -
Stdout: FAILED: failed to get a resizer for format 'gpt'
Stderr: no tools available to resize disk with 'gpt'
2023-06-24 13:07:05,564 - handlers.py[DEBUG]: finish: init-network/config-growpart: SUCCESS: config-growpart ran successfully
Last tested with Arch-Linux-x86_64-cloudimg-20230624.160251.qcow2
"Fixed" on my end by installing the gptfdisk package (or with a repart.d drop-in but this bypasses cloud-init)
Edited by Mathias