Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Jul 2018 20:56:36 +0000
From:      bugzilla-noreply@freebsd.org
To:        geom@FreeBSD.org
Subject:   [Bug 229594] Incorrect "No such geom" error when executing gpart with invalid or incorrect gpt partition number
Message-ID:  <bug-229594-14739-iVYMYjtwi6@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-229594-14739@https.bugs.freebsd.org/bugzilla/>
References:  <bug-229594-14739@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=229594

--- Comment #6 from Andrey V. Elsukov <ae@FreeBSD.org> ---
(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
open("/dev/%s", provider_name).  

> 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
> refinement)

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

-- 
You are receiving this mail because:
You are the assignee for the bug.


Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-229594-14739-iVYMYjtwi6>