--- Comment #6 from Andrey V. Elsukov <[hidden email]> ---
(In reply to Mahmoud Al-Qudsi from comment #5)
> I just realized that while gpart may not work on DISK objects, it *does*
> know about their existence, at the very least. `gpart create -s mbr aoneuh`
> returns an error while `gpart create -s mbr nvd0` (where `nvd0` is a valid
> DISK object and not (yet) the name of a valid PART object) will succeed.
gpart(8) has several sub-commands that require different objects to work with.
When you are creating PART object, it assumes that the name in argument is GEOM
provider. Many geom classes have providers, not only the DISK class.
> That means that when `gpart bootcode -b ... -p ... -i $N $DISK` is executed,
> gpart _could_ distinguish between $DISK not existing at all (which the
> current error message could be taken to assert universally) vs $DISK being a
> valid disk but not a valid PART object.
The "bootcode" command works with objects of class PART, since it requires some
knowledge about partition table. The -b argument assumes that the bootcode
should be written to the special area of partition table, that is specific for
different partitioning schemes. The -p argument assumes that bootcode should be
written to specified by -i partition, this means that PART object should exists
to be able find the name of GEOM provider, that will be open like
> My proposal is for the permutation of $N and $DISK to determine which of the
> following messages is displayed:
> * $DISK is not a valid disk
> * $DISK is not partitioned for use with gpart
> * $N is not a valid partition on $DISK (if $N is too big)
> (text is obviously just a first stab at clarifying the situation and can use
As you may see in the SYNOPSIS of gpart(8) manual page, there is only one
command, that accepts provider - it is "create", any other commands require
geom object of class PART. So, I'm not sure your suggestion fits to this