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.
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.