Again, the interactive editor is way too many steps, too many opportunities for screw-ups, and does nothing to streamline the process of adding a new disk for me.
So this is what I've come up with... fdisk -i sd1 echo "/disk2 1M-* 100%" >/tmp/disktab.new disklabel -w -dv -A -T /tmp/disktab.new sd1 && rm /tmp/disktab.new newfs /dev/rsd1a mkdir /disk2 mount /dev/sd1a /disk2 This seems kludgy, but it is more automated / flexible, and best of all, it works. I'm still curious to know if this is really the most efficient way of doing this. Thanks. > On Nov 4, 2017, at 11:16 AM, Otto Moerbeek <o...@drijf.net> wrote: > > On Sat, Nov 04, 2017 at 10:51:59AM -0400, Implausibility wrote: > >> >>> On Nov 4, 2017, at 9:39 AM, Tom Rosso <t...@oioioioo.org> wrote: >>> >>> On 2017-11-04 09:28, Implausibility wrote: >>>> I simply want to create a single partition encompassing all of the >>>> available space. >>>> I've searched the web, plus read searched the last 11k+ messages on >>>> misc@ -- but I can't seem to find any examples of defining a disk with >>>> disklabel non-interactively. >>>>> # disklabel -w sd1 'disk' >>>>> disklabel: unknown disk type: disk >>> >>> You need to create an entry in /etc/disktab for the disk type "disk", which >>> defines all of the variables that go into the disklabel that will be >>> created. man 5 disktab >>> >>> It's easier to create a disklabel interactively. >>> >> >> The snag here is that I want this to work for any size disk that I connect >> to an OpenBSD instance. It seems like the definitions in disktab are rather >> inflexible (the man page only mentions numeric sizes, not percentages or >> wildcards). >> >> It seems weird that something so common critical (adding storage) is so >> cryptic. I don't have to create a termcap entry for every new user, so it >> seems weird to have to create a similar record for every disk I want to >> format on the command line for OpenBSD. > > The interactive editor does support percentages: > > Quantities are rounded to the nearest cylinder when units are specified > for sizes (or offsets). At prompts that request a size, `*' may be > entered to indicate the rest of the available space, `%' for percentage > of total, and `&' for percentage free. > > Default is to use the whole disk anyway. There is also a section > called AUTOMATIC DISK ALLOCATION that can use a templkate file. > > -Otto >