OpenBSD Journal

Transition to support for 52 partitions

Contributed by rueda on from the biggus-diskus dept.

In -current, Theo de Raadt (deraadt@) has started the transition to support for 52 disk partitions (on a subset of hardware architectures):

CVSROOT:	/cvs
Module name:	src
Changes by:	deraadt@cvs.openbsd.org	2025/11/13 13:59:14

Modified files:
	sys/dev/ata    : wd.c 
	sys/kern       : kern_pledge.c 
	sys/sys        : disklabel.h dkio.h 
	sys/scsi       : sd.c 
	sys/dev/isa    : fdreg.h 
	sys/arch/sparc64/dev: fd.c 

Log message:
Begin transition to 52-partition support.  The partition encoding used
to be lowest 4 bits of dev_t, and now becomes 6.  This supplies 64
partitions in struct disklabel.d_partitions[MAXPARTITIONSUNIT], but we
only use 52 of these slots (an architecture can be either 16 partition
or 52 partition, depending on MD define MAXPARTITIONS).  The
52-partition limit is due to single-character representation limit of
a-zA-Z.  We supply a backwards-compat ioctl for a while which can read
an disklabel structure.
This change does not yet store 52-partition information on-disk, and
does not transition any architecture to allowing use of >16 partitions.
Those changes come soon, after this compatibility breaking change settles.

Immediate result is dev_t numbers for /dev/{sd,wd,rd,fd,...}[12345...][a-p]
become incorrect, and need to be repaired.  A sysupgrade will do this for
automatically.  For a hand-build, or a manual kernel replacement, systems
which have root *NOT ON SD0 or WD0*, probably fail into single-user and you
must perform these steps explained in /etc/rc:

#   fsck /dev/rrootdisk
#   mount -uw /dev/rootdisk /
#   cd /dev && ./MAKEDEV redodisks

Please do not try to manual-build through this on a system earlier than 7.8.

with and ok krw

Note that for most using full-disk-encryption, it is likely that root is not on sd0/wd0.

[The first tendrils of this work were committed well before the 7.8 release.]

Update:
Warning - Those with full-disk-encryption should avoid this bump until it is known to be safe. At the time of writing, there is still a problem -
https://marc.info/?l=openbsd-misc&m=176319377915316&w=2

Update:
We have a confirmed report of successful sysupgrade(8) across the bump on a full-disk-encryption (FDE) amd64 system using the (new) snapshot with BUILDINFO:

Build date: 1763270116 - Sun Nov 16 05:15:16 UTC 2025

Relevant commit appears to be:

CVSROOT:	/cvs
Module name:	src
Changes by:	deraadt@cvs.openbsd.org	2025/11/15 12:00:19

Modified files:
	sys/arch/amd64/stand/libsa: softraid_amd64.c 
	sys/arch/arm64/stand/efiboot: softraid_arm64.c 
	sys/arch/i386/stand/libsa: softraid_i386.c 
	sys/arch/riscv64/stand/efiboot: softraid_riscv64.c 

Log message:
bootblock softraid code was assuming struct disklabel fits in a 512 byte
buffer.  That is no longer true, since the on-disk is being seperated
from the in-memory.
ok krw florian hshoexer

Comments
  1. By Will Backman (bitgeist) bitgeist@yahoo.com on http://bsdtalk.blogspot.com

    The article department name committee is doing stellar work! Thanks for all the news, and for always sprinkling some humor on top.

Credits

Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original deadly.org with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]