The error occurs with a gpt formatted image, which is supported by
sfdisk.

This logic in growpart is broken for image files:

if [ -b "${DISK}p${PART}" -a "${DISK%[0-9]}" != "${DISK}" ]; then

If an image filename ends with a number, sfdisk identifies each
partition like:

${DISK}p${PART_NUMBER}

Each partition is _not_ a block device, though, so they fail the `-b
"${DISK}p${PART}"` check.

Removing that specific check fixes this issue; however, I don't know
what ramification that has for other use cases.

As a workaround, we are renaming the image file to end with a non-
numerical suffix, growing the partition, then renaming the image back to
its original name.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1835124

Title:
  growpart mishandles image filenames that end in a number

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-utils/+bug/1835124/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to