growpart fails if size of partition == start of partition
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-utils |
Fix Released
|
Medium
|
Lars Kellogg-Stedman |
Bug Description
If the size of a partition is equal to the start of a partition, growpart will fail to correctly grow the partition (and will probably end up breaking things). For example, we start with the following partition layout:
[root@growpart ~]# sfdisk --unit=S --dump /dev/vdb
# partition table of /dev/vdb
unit: sectors
/dev/vdb1 : start= 2048, size= 1024000, Id=83
/dev/vdb2 : start= 1026048, size= 1026048, Id=83
/dev/vdb3 : start= 0, size= 0, Id= 0
/dev/vdb4 : start= 0, size= 0, Id= 0
Growpart modifies that table with the following sed expression:
sed "\|^\s*${dpart} |s/${pt_
fail "failed to change size in output"
That becomes:
sed '\|^\s*/dev/vdb2 |s/1026048,
That will erroneously match the partition start, rather than the
partition size, which results in the partition map looking like:
[root@growpart ~]# sfdisk --unit=S --dump /dev/vdb
# partition table of /dev/vdb
unit: sectors
/dev/vdb1 : start= 2048, size= 1024000, Id=83
/dev/vdb2 : start= 3168223, size= 1026048, Id=83
/dev/vdb3 : start= 0, size= 0, Id= 0
/dev/vdb4 : start= 0, size= 0, Id= 0
Notice that the partition is still the same size, but it now starts at
the wrong location.
Related branches
- Scott Moser (community): Approve
-
Diff: 112 lines (+96/-1)2 files modifiedbin/growpart (+1/-1)
test/test-growpart-start-matches-size (+95/-0)
Changed in cloud-utils: | |
status: | New → Confirmed |
importance: | Undecided → Medium |
assignee: | nobody → Lars Kellogg-Stedman (larsks) |
status: | Confirmed → Fix Committed |
This bug is believed to be fixed in cloud-utils in version 0.31. If this is still a problem for you, please make a comment and set the state back to New
Thank you.