OpenBSD Journal

Call for testing and comment: Make the installer prefer >1G disks

Contributed by Peter N. M. Hansteen on from the get those disks sorted dept.

You can tell it's right after a release is cut when new ideas are fielded in patches to tech@. One such small but potentially important change that is being aired now is a change to the installer to suggest the larger one when several disks are available. Klemens Nanni (kn@) describes the motivation for the change as

[…] whenever install media, small USB sticks or softraid(4) keydisks attach
before you actual disk, defaulting to sd0 is most certainly not what you want.

An easy rule of thumb that works great for me is to reshuffle the list of valid
root disks such that small ones come last.

The message with the patch reads:

List:       openbsd-tech
Subject:    installer: default root disk: prefer those bigger than 1G
From:       Klemens Nanni <kn () openbsd ! org>
Date:       2025-05-01 15:41:25

Now we show all valid root disks and pick the first one, i.e. the
alphanumerically lowest value, as default:
	Available disks are: sd0 sd1.
	Which disk is the root disk? ('?' for details) [sd0] ?
	    sd0: VirtIO, Block Device  (0.8G)
	    sd1: VirtIO, Block Device  (3.0G)
	Available disks are: sd0 sd1.
	Which disk is the root disk? ('?' for details) [sd0] 

Finding the "best" disk as default is hard, but I reckon we can prefer some
disks more than others;  the example above is from a common test routine of mine:

	# vmctl start -d install77.img -d disk.img ...

But whenever install media, small USB sticks or softraid(4) keydisks attach
before you actual disk, defaulting to sd0 is most certainly not what you want.

An easy rule of thumb that works great for me is to reshuffle the list of valid
root disks such that small ones come last.  This is easy to code and cannot
break anything, so now you get:

	Which disk is the root disk? ('?' for details) [sd1] 

Do this only on install so upgrade behaviour for tiny root disks with big data
disks remains unchanged.


NB: _default is an odd name as the variable holds a list of devices.
    _ask() gets them, takes its first and second argument as question
    as default answer, respectively, and ignores the rest.

    But further the variable is treated as list, exactly the same way
    I do upfront now, so better call it _rootdisks. 


Feedback? OK?

Index: install.sub
===================================================================

followed by the patch itself.

What do you think? Would this change make life easier when you install OpenBSD?


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.]