Skip to content

Conversation

@soap-phia
Copy link

I also updated the examples in the usage function to

Example:
- ${0##/} /dev/sda 1
- ${0##
/} /dev/sda1
Resize partition 1 on /dev/sda

- ${0##*/} --free-percent=10 /dev/sda 1
- ${0##*/} --free-percent=10 /dev/sda1
  Resize partition 1 on /dev/sda so that 10% of the disk is unallocated

instead of

Example:
- ${0##*/} /dev/sda 1
Resize partition 1 on /dev/sda

- ${0##*/} --free-percent=10 /dev/sda 1
  Resize partition 1 on /dev/sda so that 10% of the disk is unallocated

Copy link

@simpansoftware simpansoftware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks good, idk what more to expect

bin/growpart Outdated
PART=$(echo "$cur" | sed -E 's/.*[^0-9]([0-9]+)$/\1/')
;;
*)
DISK="$cur"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would handle nvme incorrectly , wouldn't it? Device is nvme0n1 and partition suffix "p1". Loop devices also might match.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'll look at it again, from what i recall it handled nvme okay

Copy link
Contributor

@dermotbradley dermotbradley Sep 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would handle nvme incorrectly , wouldn't it? Device is nvme0n1 and partition suffix "p1". Loop devices also might match.

The rule-of-thumb I've always used (which appears to be correct) is that if the device name ends with a digit then there is a "p" separator between the device name and the partition number when referred to a partition - this applies to NVME devices, loop devices, software RAID device (/dev/md0), SDcard devices (/dev/mmcblk0) etc

Actually I just checked the growpart code and (for separate specification of device and partnum) it already handles this: https://github.com/canonical/cloud-utils/blob/main/bin/growpart#L263-L279

exit $ret

# vi: ts=4 noexpandtab
# vi: ts=4 noexpandtab
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't strip trailing newline

@soap-phia
Copy link
Author

okay, i fixed this and it parses nvme correctly now in my testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants