Download raw body.
editing auto-allocated disklabels can lead to overlapping partitions
Hi,
as phessler experienced, editing auto-allocated labels can lead to
overlapping partitions. The culprit is the resize code, which assumes
that the partitions when sorted by letter are also sorted by offset.
That is no longer true after the following modifications to an
auto-allocated label (with a large disk): run disklabel -AE (as the
installer does when you say you want to edit the auto-allocated
label). Then delete a partition (e.g. g containing /usr/X11R6), and
add it again. The editor will suggest to put the new g after the last
(home) partition, since the most free space is there. If you then
resize home and make it larger, it will overlap with the new g
partition. Resizing g and then resizing home would have avoided this.
This detects the case, avoiding a malformed label by suggesting to
delete one partition of the overlapping ones. I have not found the
time or energy yet to create a better solution. But this at least
avoids silently creating overlapping partitions.
-Otto
Index: editor.c
===================================================================
RCS file: /home/cvs/src/sbin/disklabel/editor.c,v
diff -u -p -r1.418 editor.c
--- editor.c 22 Mar 2024 21:49:52 -0000 1.418
+++ editor.c 27 Aug 2025 08:37:28 -0000
@@ -402,6 +402,7 @@ editor(int f)
else
fputs("Resize only implemented for auto "
"allocated labels\n", stderr);
+ has_overlap(&newlab);
break;
case 'r': {
editing auto-allocated disklabels can lead to overlapping partitions