Contributed by pitrh on 2015-05-05 from the we slice, we dice, those platters dept.

In a this commit, a first in a series, Henning Brauer (henning@) made disk allocations during automatic installs much more flexible via the introduction of diskablel templates. The matching installer bits came along via this commit by Robert Peichaer (rpe@).

Quoting the updated disklabel(8) man page,

A template for the automatic allocation can be passed to disklabel using -T option.

But the more exciting news is the template format:

The template consists of one line per partition, with each line giving mountpoint, min-max size range, and percentage of disk, space-separated. Max can be unlimited by specifying '*'. If only mountpoint and min size are given, the partition is created with that exact size.

And here's an example of a working disklabel template (stolen from the man page):

/ 250M swap 80-256M 10% /tmp 120M-4G 8% /var 80M-4G 13% /usr 900M-2G 5% /usr/X11R6 512M-1G 3% /usr/local 2G-10G 10% /usr/src 1-2G 2% /usr/obj 1.3G-2G 4% /home 1G-* 45%

and here is a sample of output from an autoinstall session using the new feature:

Terminal type? [vt220] vt220 System hostname? (short form, e.g. 'foo') [autoinstalltest] autoinstalltest Available network interfaces are: vio0 vlan0. Which network interface do you wish to configure? (or 'done') [vio0] vio0 IPv4 address for vio0? (or 'dhcp' or 'none') [dhcp] dhcp DHCPREQUEST on vio0 to 255.255.255.255 DHCPACK from 10.1.1.250 (00:15:17:20:bb:94) bound to 10.1.1.178 -- renewal in 21600 seconds. IPv6 address for vio0? (or 'rtsol' or 'none') [none] none Available network interfaces are: vio0 vlan0. Which network interface do you wish to configure? (or 'done') [done] done Using DNS domainname bsws.de Using DNS nameservers at 10.53.0.1 10.53.0.2 Password for root account? Public ssh key for root account? [none] no-port-forwarding,no-x11-forwarding ecdsa-sha2-nistp521 AAAAE.... Start sshd(8) by default? [yes] yes Start ntpd(8) by default? [no] yes NTP server? (hostname or 'default') [default] ntp.bsws.de Do you expect to run the X Window System? [yes] no Change the default console to com0? [yes] yes Available speeds are: 9600 19200 38400 57600 115200. Which speed should com0 use? (or 'done') [9600] 9600 Setup a user? (enter a lower-case loginname, or 'no') [no] no Available disks are: sd0. Which disk is the root disk? ('?' for details) [sd0] sd0 Use DUIDs rather than device names in fstab? [yes] yes Disk: sd0 geometry: 6527/255/63 [104857600 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 - 6526 254 63 [ 64: 104856191 ] OpenBSD Use (W)hole disk, use the (O)penBSD area, or (E)dit the MBR? [OpenBSD] OpenBSD URL to autopartitioning template for disklabel? [none] http://10.1.1.251/autodisklabel Fetching http://10.1.1.251/autodisklabel /dev/rsd0a: 250.0MB in 512000 sectors of 512 bytes 4 cylinder groups of 62.50MB, 4000 blocks, 8064 inodes each /dev/rsd0g: 1024.0MB in 2097152 sectors of 512 bytes 6 cylinder groups of 202.47MB, 12958 blocks, 25984 inodes each /dev/rsd0d: 5120.0MB in 10485760 sectors of 512 bytes 26 cylinder groups of 202.47MB, 12958 blocks, 25984 inodes each /dev/rsd0e: 1024.0MB in 2097152 sectors of 512 bytes 6 cylinder groups of 202.47MB, 12958 blocks, 25984 inodes each /dev/rsd0f: 2048.0MB in 4194304 sectors of 512 bytes 11 cylinder groups of 202.47MB, 12958 blocks, 25984 inodes each /dev/sd0a (dc964774ade6fd9f.a) on /mnt type ffs (rw, asynchronous, local) /dev/sd0g (dc964774ade6fd9f.g) on /mnt/home type ffs (rw, asynchronous, local, nodev, nosuid) /dev/sd0d (dc964774ade6fd9f.d) on /mnt/usr type ffs (rw, asynchronous, local, nodev) /dev/sd0e (dc964774ade6fd9f.e) on /mnt/var type ffs (rw, asynchronous, local, nodev, nosuid) /dev/sd0f (dc964774ade6fd9f.f) on /mnt/var/log type ffs (rw, asynchronous, local, nodev, nosuid) Let's install the sets! Location of sets? (cd0 disk http or 'done') [http] http HTTP proxy URL? (e.g. 'http://proxy:8080', or 'none') [none] none HTTP Server? (hostname, list#, 'done' or '?') [pkg.bsws.de] pkg.bsws.de Server directory? [pub/OpenBSD/snapshots/amd64] pub/OpenBSD/snapshots/amd64 Select sets by entering a set name, a file name pattern or 'all'. De-select sets by prepending a '-' to the set name, file name pattern or 'all'. Selected sets are labelled '[X]'. [X] bsd [X] base57.tgz [X] game57.tgz [X] xfont57.tgz [X] bsd.rd [X] comp57.tgz [X] xbase57.tgz [X] xserv57.tgz [X] bsd.mp [X] man57.tgz [X] xshare57.tgz [ ] site57.tgz Set name(s)? (or 'abort' or 'done') [done] -all bsd* base* etc* man* site* [X] bsd [X] base57.tgz [ ] game57.tgz [ ] xfont57.tgz [X] bsd.rd [ ] comp57.tgz [ ] xbase57.tgz [ ] xserv57.tgz [X] bsd.mp [X] man57.tgz [ ] xshare57.tgz [X] site57.tgz Set name(s)? (or 'abort' or 'done') [done] done Get/Verify SHA256.sig 100% |**************************| 1889 00:00 Signature Verified Get/Verify bsd 100% |**************************| 9708 KB 00:00 Get/Verify bsd.rd 100% |**************************| 7429 KB 00:00 Get/Verify bsd.mp 100% |**************************| 9748 KB 00:00 Get/Verify base57.tgz 100% |**************************| 54679 KB 00:04 Get/Verify man57.tgz 100% |**************************| 8769 KB 00:00 Get/Verify site57.tgz 100% |**************************| 98142 00:00 Checksum test for site57.tgz failed. Continue anyway? [no] yes Unverified sets: site57.tgz. Continue without verification? [no] yes Installing bsd 100% |**************************| 9708 KB 00:00 Installing bsd.rd 100% |**************************| 7429 KB 00:00 Installing bsd.mp 100% |**************************| 9748 KB 00:00 Installing base57.tgz 100% |**************************| 54679 KB 00:06 Extracting etc.tgz 100% |**************************| 109 KB 00:00 Installing man57.tgz 100% |**************************| 8769 KB 00:00 Installing site57.tgz 100% |**************************| 98142 00:00 Location of sets? (cd0 disk http or 'done') [done] done What timezone are you in? ('?' for list) [Europe/Berlin] Europe/Berlin Saving configuration files...done. Making all device nodes...done. Multiprocessor machine; using bsd.mp instead of bsd. CONGRATULATIONS! Your OpenBSD install has been successfully completed! To boot the new system, enter 'reboot' at the command prompt. When you login to your new system the first time, please read your mail using the 'mail' command.

This will turn up in a snapshot on a mirror near you soon, testing and feedback is most welcome.