also broken in 10.3 (Re: "gpart add" falsely claiming "No space left on device")

Perry Hutchison perryh at pluto.rain.com
Sun Sep 11 03:10:49 UTC 2016


Warren Block <wblock at wonkity.com> wrote:
> On Fri, 9 Sep 2016, Perry Hutchison wrote:
> > Getting back to the original inquiry, I'm still mystified as to
> > why gpart won't create a partition in the space that it reports
> > as being free.  Does anyone have a clue what is going on, or how
> > to find out?
>
> It could be an actual bug.  gpart and the man page have been revised 
> quite a bit over the last few years.

Indeed.  10.3 behaves differently.  (Not better, but differently.)

I tried booting the stick and using its own gpart to create the new
partition, and it failed silently:  it claimed to have created the
partition, and "gpart show" showed it, but it was gone after rebooting.

I tried several times, sometimes allowing the "gpart add" to do the
operation immediately and other times specifying "-f x" followed by
"gpart commit", and the new partition never survived a reboot.

It is not a matter of the GPT somehow being silently read-only:
I also applied labels to the original partitions, at least once
each before and after creating the new partition, and the label
operations always survived the reboot but the partition creation
never did.

To reproduce (from the top):

dd FreeBSD-10.3-RELEASE-i386-memstick.img to a flash drive.
(I'm using a 4GB flash drive, but the size probably doesn't much
matter.)  Note that this is the i386 memstick.img; I have no idea
whether anything similar would happen with other architectures.

Boot it into single-user mode.  It will be da0 unless there are
other "da" drives attached.

# gpart recover da0   # resizes the GPT to the stick

I rebooted here for other reasons; dunno if it matters.

# gpart show da0      # shows 3 partitions and some free space
# gpart add -t freebsd-ufs da0	# reports "da0p4 added" (or similar)
# gpart show da0      # shows 4 partitions including the new one
# shutdown -r now

after reboot:

# gpart show da0      # shows 3 partitions and some free space

BTW I also discovered in the course of this that "gpart commit" with
no pending operations misleadingly says "Operation not permitted"
rather than "Nothing to commit" or "No pending operations".


More information about the freebsd-questions mailing list