FreeBSD-10.3-RELEASE-i386-memstick.img installer changes contents of USB flash drive

Perry Hutchison perryh at pluto.rain.com
Sun Oct 2 09:13:41 UTC 2016


Warren Block <wblock at wonkity.com> wrote:
> On Sun, 2 Oct 2016, Ian Smith wrote:
> > And then Perry Hutchinson (cc'd) is having the 'opposite' problem of
> > wanting to update the 10.3 i386 memstick he'd booted off with gpart
> > recover and gpart add for another partition, apparently successfully
> > according to gpart show, only to have the updates disappear on reboot?
>
> Pretty sure that's an unrelated problem I've seen myself:
> http://www.wonkity.com/~wblock/docs/html/labels.html
>
> If you change partition labels (or something) and then mount them, that 
> information is lost.  If you reboot first, something works right.

What I'm seeing does not fit that pattern.  The sequence is:

1.  dd the memstick image file to a 4GB flash drive.
2.  Boot memstick in single-user mode, which mounts the root partition
    read-only and complains about a missing secondary GPT.
3.  # gpart recover da0
4.  Reboot, again in single-user mode, which mounts the root partition 
    read-only.  No GPT complaints this time.
5.  # gpart show da0
    This shows 3 partitions and 3.1 GB of free space.
6.  # gpart add -t freebsd-ufs da0
7.  # gpart show da0
    This shows 4 partitions and no free space, as expected.
8.  Reboot, again in single-user mode, which mounts the root partition 
    read-only.  No GPT complaints.
9.  # gpart show da0
    This shows 3 partitions and 3.1 GB of free space.  WTF?????

Note that nothing got mounted between steps 6 and 8.

I can do 'gpart modify -l' to add labels to the 3 original
partitions before or after step 6, and those labels survive
the step 8 reboot although the result of 'gpart add' does not.
I tried setting kern.geom.debugflags to 16 (the foot-shooting
flag) before the 'gpart add' and it made no difference.  And
no, it is not a case of an orderly shutdown having written out
an old in-memory instance of the GPT:  I went so far as to yank
the stick out of the USB port after step 7, and then power-cycle
the machine, and the new partition *still* was gone after the
reboot.


More information about the freebsd-questions mailing list