-
Notifications
You must be signed in to change notification settings - Fork 38
growpart: allow /dev/devicepartnum along with /dev/device partnum #62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
simpansoftware
left a comment
There was a problem hiding this 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" |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
|
okay, i fixed this and it parses nvme correctly now in my testing |
I also updated the examples in the usage function to
Example:
- ${0##/} /dev/sda 1
- ${0##/} /dev/sda1
Resize partition 1 on /dev/sda
instead of
Example:
- ${0##*/} /dev/sda 1
Resize partition 1 on /dev/sda