Index | Thread | Search

From:
Peter Hessler <phessler@theapt.org>
Subject:
Re: editing auto-allocated disklabels can lead to overlapping partitions
To:
Otto Moerbeek <otto@drijf.net>
Cc:
tech@openbsd.org
Date:
Sat, 30 Aug 2025 21:51:21 +0200

Download raw body.

Thread
On 2025 Aug 27 (Wed) at 10:54:04 +0200 (+0200), Otto Moerbeek wrote:
: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
:

Yup, this would have identified the issue for me before I finished
installing, which would have been enough.

OK


: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': {
:

-- 
The Computer made me do it.