Public bug reported:

When growpart attempts to determine the partition to resize, it uses
this logic:

$ sed -n '266,275p' $(which growpart)
        dpart="${DISK}${PART}" # disk and partition number
        if [ -b "${DISK}p${PART}" -a "${DISK%[0-9]}" != "${DISK}" ]; then
                # for block devices that end in a number (/dev/nbd0)
                # the partition is "<name>p<partition_number>" (/dev/nbd0p1)
                dpart="${DISK}p${PART}"
        elif [ "${DISK#/dev/loop[0-9]}" != "${DISK}" ]; then
                # for /dev/loop devices, sfdisk output will be <name>p<number>
                # format also, even though there is not a device there.
                dpart="${DISK}p${PART}"
        fi

If the disk is an image, and the image filename ends with a number, the
partition will be "${DISK}p${PART}"; however, "${DISK}p${PART}" will not
be a block device. Thus, the partition is improperly identified as just
"${DISK}${PART}".

This gives us a failure like:

+ growpart -v -v -v disk-uefi.ext4 1
update-partition set to true
resizing 1 on disk-uefi.ext4 using resize_sfdisk_gpt
running[sfd_list][erronly] sfdisk --list --unit=S disk-uefi.ext4
6291456 sectors of 512. total size=3221225472 bytes
running[sfd_dump][erronly] sfdisk --unit=S --dump disk-uefi.ext4
## sfdisk --unit=S --dump disk-uefi.ext4
label: gpt
label-id: A9F73A73-50FD-4335-9082-1249985F154D
device: disk-uefi.ext4
unit: sectors
first-lba: 34
last-lba: 6291422

disk-uefi.ext4p1 : start=      227328, size=     4384735, 
type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, 
uuid=C1191CD2-0753-4A53-8CD4-E6079735CA42
disk-uefi.ext4p14 : start=        2048, size=        8192, 
type=21686148-6449-6E6F-744E-656564454649, 
uuid=3A2AD377-EB6D-4689-9126-35148C003A95
disk-uefi.ext4p15 : start=       10240, size=      217088, 
type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, 
uuid=98C675C8-4FF6-425C-B783-E77FDE70C967
FAILED: failed to get start and end for disk-uefi.ext41 in disk-uefi.ext4

** Affects: cloud-utils (Ubuntu)
     Importance: Undecided
         Status: New

-- 
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/ubuntu/+source/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