On Mon, Aug 05, 2024 at 03:42:48AM +0200, David Uhden Collado wrote: > > Why not just use a custom disklabel template that suits your needs? This > is the -t option to /sbin/disklabel. > > How is it possible to use a custom template from the OpenBSD installer?
You'll need to drop to the shell and invoke the disklabel utility manually. I've included a transcript from a sample console session below. Whilst probably not ideal for someone who is new to OpenBSD, if you've got experience of other unix-like operating systems it's not too much trouble. > On > the other hand, this workaround is not the most convenient since one > typically does not reinstall OpenBSD frequently. New users often do not > realize this issue and only discover after installing and configuring their > system that they are utilizing less than half of the available storage on > their hard drive, which nowadays is typically around 1TB in capacity. Generally I would expect somebody who is new to OpenBSD to do a scratch install on a spare machine to try out the system, but then re-install at least once rather than continue using that scratch system as their 'final' installation. For nothing else, because generally people fiddle with all sorts of settings that have effects beyond what they realise, (including security related effects), and it's not always obvious how to twiddle the knobs back. Also, some people install without FDE and later want it. A re-install is not a bad thing. (In fact, part of my job is to re-install our servers from scratch for every release - we never use the upgrade tools.) But more specifically to the issue of disk partitioning, there are three other points here: Firstly, the physically last partition that the installer automatically creates is mounted on /home, and this is usually the one that the average home user is going to want to expand in to free space that follows. Secondly, having an enormous /home or any other standard system partition is not necessarily desirable for various reasons, some of which have already been pointed out. So adding a separate partition using the free space and mounting it on, say, /storage, might also be a better idea. Thirdly, unless you are on a machine with hardware constraints, (laptop, SBC, etc), why would you want a boot/system disk larger than 512 Gb? Keeping the boot/system disk small and installing a separate drive for bulk data storage has the benefits of easy replacement in case of failure, (you're only replacing and re-installing the system drive, not all of your data), and it's also convenient if you want to swap out the drive for another to install a new release, but keep the option of returning to the old system without the hassle of restoring. Console transcript follows: Welcome to the OpenBSD/amd64 7.5 installation program. (I)nstall, (U)pgrade, (A)utoinstall or (S)hell? s # cd /dev # sh ./MAKEDEV sd0 sd1 # mkdir /mnt3 # mount /dev/sd1d /mnt3 # ls /mnt3 custom_template # cat /mnt3/custom_template / 150M-1G 5 SWAP 80M-16G 10 /tmp 120M-4G 8 /var 80M-40G 13 /usr 1500M-30G 10 /usr/X11R6 384M-1G 3 /usr/local 1G-20G 15 /usr/src 2G-5G 2 /usr/obj 5G-6G 4 /home 1G-* 30 # fdisk -e sd0 Enter 'help' for information sd0: 1> reinit Disk: sd0 geometry: 133674/255/63 [2147483648 Sectors] Offset: 0 Signature: 0xAA55 Starting Ending LBA Info: #: id C H S - C H S [ start: size ] ------------------------------------------------------------------------------- 0: 00 0 0 0 - 0 0 0 [ 0: 0 ] Unused 1: 00 0 0 0 - 0 0 0 [ 0: 0 ] Unused 2: 00 0 0 0 - 0 0 0 [ 0: 0 ] Unused *3: A6 0 1 2 - 133674 172 2 [ 64: 2147483584 ] OpenBSD Use 'write' to update disk. sd0*: 1> update Machine code updated. sd0*: 1> w Writing MBR at offset 0. sd0: 1> q # disklabel -T /mnt3/custom_template -E sd0 Label editor (enter '?' for help at any prompt) sd0> p OpenBSD area: 64-2147483648; size: 2147483584; free: 2147483584 # size offset fstype [fsize bsize cpg] c: 2147483648 0 unused sd0> A sd0*> p g OpenBSD area: 64-2147483648; size: 1024.0G; free: 0.0G # size offset fstype [fsize bsize cpg] a: 1.0G 64 4.2BSD 2048 16384 1 # / b: 16.0G 2097216 swap c: 1024.0G 0 unused d: 4.0G 35651648 4.2BSD 2048 16384 1 # /tmp e: 40.0G 44040256 4.2BSD 2048 16384 1 # /var f: 30.0G 127926336 4.2BSD 2048 16384 1 # /usr g: 1.0G 190840896 4.2BSD 2048 16384 1 # /usr/X11R6 h: 20.0G 192938048 4.2BSD 2048 16384 1 # /usr/local i: 5.0G 234881088 4.2BSD 2048 16384 1 # /usr/src j: 6.0G 245366848 4.2BSD 2048 16384 1 # /usr/obj k: 901.0G 257949824 4.2BSD 8192 65536 1 # /home sd0*> w sd0> q No label changes. # exit erase ^?, werase ^W, kill ^U, intr ^C, status ^T Welcome to the OpenBSD/amd64 7.5 installation program. (I)nstall, (U)pgrade, (A)utoinstall or (S)hell? i At any prompt except password prompts you can escape to a shell by typing '!'. Default answers are shown in []'s and are selected by pressing RETURN. You can exit this program at any time by pressing Control-C, but this can leave your system in an inconsistent state. Terminal type? [vt220] xterm System hostname? (short form, e.g. 'foo') foo DNS domain name? (e.g. 'example.com') [my.domain] DNS nameservers? (IP address list or 'none') [none] Password for root account? (will not echo) Password for root account? (again) Start sshd(8) by default? [yes] Change the default console to com0? [yes] Available speeds are: 9600 19200 38400 57600 115200. Which speed should com0 use? (or 'done') [115200] Setup a user? (enter a lower-case loginname, or 'no') [no] Since no user was setup, root logins via sshd(8) might be useful. WARNING: root is targeted by password guessing attacks, pubkeys are safer. Allow root ssh login? (yes, no, prohibit-password) [no] Available disks are: sd0 sd1. Which disk is the root disk? ('?' for details) [sd0] Encrypt the root disk with a (p)assphrase or (k)eydisk? [no] Disk: sd0 geometry: 133674/255/63 [2147483648 Sectors] Offset: 0 Signature: 0xAA55 Starting Ending LBA Info: #: id C H S - C H S [ start: size ] ------------------------------------------------------------------------------- 0: 00 0 0 0 - 0 0 0 [ 0: 0 ] Unused 1: 00 0 0 0 - 0 0 0 [ 0: 0 ] Unused 2: 00 0 0 0 - 0 0 0 [ 0: 0 ] Unused *3: A6 0 1 2 - 133674 172 2 [ 64: 2147483584 ] OpenBSD Use (W)hole disk MBR, whole disk (G)PT, (O)penBSD area or (E)dit? [OpenBSD] The auto-allocated layout for sd0 is: # size offset fstype [fsize bsize cpg] a: 1.0G 64 4.2BSD 2048 16384 1 # / b: 12.2G 2097216 swap c: 1024.0G 0 unused d: 4.0G 27754560 4.2BSD 2048 16384 1 # /tmp e: 28.0G 36143168 4.2BSD 2048 16384 1 # /var f: 30.0G 94797888 4.2BSD 2048 16384 1 # /usr g: 1.0G 157712448 4.2BSD 2048 16384 1 # /usr/X11R6 h: 20.0G 159809600 4.2BSD 2048 16384 1 # /usr/local i: 3.0G 201752640 4.2BSD 2048 16384 1 # /usr/src j: 6.0G 208044096 4.2BSD 2048 16384 1 # /usr/obj k: 300.0G 220627008 4.2BSD 4096 32768 1 # /home Use (A)uto layout, (E)dit auto layout, or create (C)ustom layout? [a] c Label editor (enter '?' for help at any prompt) sd0> p g OpenBSD area: 64-2147483648; size: 1024.0G; free: 0.0G # size offset fstype [fsize bsize cpg] a: 1.0G 64 4.2BSD 2048 16384 1 b: 16.0G 2097216 swap c: 1024.0G 0 unused d: 4.0G 35651648 4.2BSD 2048 16384 1 e: 40.0G 44040256 4.2BSD 2048 16384 1 f: 30.0G 127926336 4.2BSD 2048 16384 1 g: 1.0G 190840896 4.2BSD 2048 16384 1 h: 20.0G 192938048 4.2BSD 2048 16384 1 i: 5.0G 234881088 4.2BSD 2048 16384 1 j: 6.0G 245366848 4.2BSD 2048 16384 1 k: 901.0G 257949824 4.2BSD 8192 65536 1 sd0> n a mount point: [none] / sd0> n d mount point: [none] /tmp sd0> n e mount point: [none] /var sd0> n f mount point: [none] /usr sd0> n g mount point: [none] /usr/X11R6 sd0> n h mount point: [none] /usr/local sd0> n i mount point: [none] /usr/src sd0> n j mount point: [none] /usr/obj sd0> n k mount point: [none] /home sd0> p g OpenBSD area: 64-2147483648; size: 1024.0G; free: 0.0G # size offset fstype [fsize bsize cpg] a: 1.0G 64 4.2BSD 2048 16384 1 # / b: 16.0G 2097216 swap c: 1024.0G 0 unused d: 4.0G 35651648 4.2BSD 2048 16384 1 # /tmp e: 40.0G 44040256 4.2BSD 2048 16384 1 # /var f: 30.0G 127926336 4.2BSD 2048 16384 1 # /usr g: 1.0G 190840896 4.2BSD 2048 16384 1 # /usr/X11R6 h: 20.0G 192938048 4.2BSD 2048 16384 1 # /usr/local i: 5.0G 234881088 4.2BSD 2048 16384 1 # /usr/src j: 6.0G 245366848 4.2BSD 2048 16384 1 # /usr/obj k: 901.0G 257949824 4.2BSD 8192 65536 1 # /home sd0> w sd0> q No label changes. /dev/rsd0a: 1024.0MB in 2097152 sectors of 512 bytes 6 cylinder groups of 202.50MB, 12960 blocks, 25920 inodes each /dev/rsd0k: 922623.9MB in 1889533824 sectors of 512 bytes 283 cylinder groups of 3266.88MB, 52270 blocks, 104704 inodes each /dev/rsd0d: 4096.0MB in 8388608 sectors of 512 bytes 21 cylinder groups of 202.50MB, 12960 blocks, 25920 inodes each /dev/rsd0f: 30720.0MB in 62914560 sectors of 512 bytes 152 cylinder groups of 202.50MB, 12960 blocks, 25920 inodes each /dev/rsd0g: 1024.0MB in 2097152 sectors of 512 bytes 6 cylinder groups of 202.50MB, 12960 blocks, 25920 inodes each /dev/rsd0h: 20480.0MB in 41943040 sectors of 512 bytes 102 cylinder groups of 202.50MB, 12960 blocks, 25920 inodes each /dev/rsd0j: 6144.0MB in 12582912 sectors of 512 bytes 31 cylinder groups of 202.50MB, 12960 blocks, 25920 inodes each /dev/rsd0i: 5120.0MB in 10485760 sectors of 512 bytes 26 cylinder groups of 202.50MB, 12960 blocks, 25920 inodes each /dev/rsd0e: 40960.0MB in 83886080 sectors of 512 bytes 203 cylinder groups of 202.50MB, 12960 blocks, 25920 inodes each Available disks are: sd1. Which disk do you wish to initialize? (or 'done') [done] /dev/sd0a (203f83ed7f78027b.a) on /mnt type ffs (rw, asynchronous, local) /dev/sd0k (203f83ed7f78027b.k) on /mnt/home type ffs (rw, asynchronous, local, nodev, nosuid) /dev/sd0d (203f83ed7f78027b.d) on /mnt/tmp type ffs (rw, asynchronous, local, nodev, nosuid) /dev/sd0f (203f83ed7f78027b.f) on /mnt/usr type ffs (rw, asynchronous, local, nodev) /dev/sd0g (203f83ed7f78027b.g) on /mnt/usr/X11R6 type ffs (rw, asynchronous, local, nodev) /dev/sd0h (203f83ed7f78027b.h) on /mnt/usr/local type ffs (rw, asynchronous, local, nodev) /dev/sd0j (203f83ed7f78027b.j) on /mnt/usr/obj type ffs (rw, asynchronous, local, nodev, nosuid) /dev/sd0i (203f83ed7f78027b.i) on /mnt/usr/src type ffs (rw, asynchronous, local, nodev, nosuid) /dev/sd0e (203f83ed7f78027b.e) on /mnt/var type ffs (rw, asynchronous, local, nodev, nosuid) Let's install the sets!