Re: Vanishing GPT/UFS labels
Warner Losh <[email protected]> Thu, 21 May 2026 17:15:30 -0600
| Newsgroups | gmane.os.freebsd.devel.hackers |
|---|---|
| Message-ID | <CANCZdfqQ=ZKSmvnt+9TfTzEcCVq6sVFqx+HQE35q3qXqn5MS-g@mail.gmail.com> |
On Thu, May 21, 2026 at 6:46 AM Stéphane Rochoy < [email protected]> wrote: > Hi Hackers, > > I have some code at hand that rely on GPT and UFS labels to abstract > things a bit. But a few observations puzzle me. > > My initial observations were made on an nda(4) disk but I managed to > reproduce with an md(4) one on a15.0-RELEASE-p3 (5cf7232732d5) machine: > > dd if=/dev/zero of=zero.img bs=100M count=1 > md=`mdconfig -f zero.img` > gpart create -s gpt $md > gpart add -i 1 -l foo -t freebsd-swap $md > gpart add -i 2 -l bar -t freebsd-ufs $md > newfs -L bar /dev/${md}p2 > > From here the following devices are available to match the labels: > > /dev/gpt/foo > /dev/gpt/bar > /dev/ufs/bar > > When I mount using the underlying device, /dev/${md}p2, both > /dev/gpt/bar and /dev/ufs/bar vanish. And when I umount (using the mount > point) both are back. > > When I mount using the UFS label, /dev/ufs/bar, only /dev/gpt/bar > vanish. And when I umount the GPT label don't come back. > > GEOM don't seems to agree with itself: `gpart show -l $md` do confirm both > partitions kept their GPT label but `glabel status` don't: > > $ gpart show -l $md > => 40 204720 md0 GPT (100M) > 40 20480 1 foo (10M) > 20520 184240 2 bar (90M) > $ glabel status | grep -e foo -e bar > gpt/foo N/A md0p1 > ufs/bar N/A md0p2 > > I would be happy to hunt what looks like bugs to me but I need some > insight first: what is the rationale behind the idea to remove a device > on mount and, possibly, restore it on umount? > This sounds like the intentional behavior of geom to withdraw the devices when aliases are mounted. Warner