Re: Vanishing GPT/UFS labels
Mark Millard <[email protected]> Fri, 22 May 2026 10:02:18 -0700
| Newsgroups | gmane.os.freebsd.devel.hackers |
|---|---|
| Message-ID | <[email protected]> |
On 5/21/26 23:53, Stéphane Rochoy wrote: > Warner Losh <[email protected]> writes: > >> On Thu, May 21, 2026 at 6:46 AM Stéphane Rochoy <[email protected]> wrote: >> … >> 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. > > So what I observe when mounting/umounting via the underlying device > (/dev/${md}p2) is the expected behavior. > > But there's some problems when mounting/umounting via the UFS label > (/dev/ufs/bar): > - on mount, /dev/ufs/bar should vanish too Are you saying that the mounted /dev/ufs/bar that shows up in df -m should instead show up via under a path one did not specify, such as a /dev/mdp2 ? My example below is a gpt mount context instead of ufs, just because that is what I happen to have around: # gpart show -pl /dev/da0 => 34 2930277101 da0 GPT (1.4T) 34 32734 - free - (16M) 32768 501760 da0p1 PBaseEFI (245M) 534528 20971520 da0p2 PBaseSwp10 (10G) 21506048 29360128 da0p3 PBaseSwp14 (14G) 50866176 33554432 da0p4 PBaseSwp16 (16G) 84420608 67108864 da0p5 PBaseSwp32 (32G) 151529472 96468992 da0p6 PBaseSwp46 (46G) 247998464 268435456 da0p7 PBaseSwp128 (128G) 516433920 7340032 da0p8 PBaseSwp3p5 (3.5G) 523773952 13096960 - free - (6.2G) 536870912 2357198848 da0p9 PBaseUFS (1.1T) 2894069760 36207375 - free - (17G) # gpart show -p /dev/da0 => 34 2930277101 da0 GPT (1.4T) 34 32734 - free - (16M) 32768 501760 da0p1 efi (245M) 534528 20971520 da0p2 freebsd-swap (10G) 21506048 29360128 da0p3 freebsd-swap (14G) 50866176 33554432 da0p4 freebsd-swap (16G) 84420608 67108864 da0p5 freebsd-swap (32G) 151529472 96468992 da0p6 freebsd-swap (46G) 247998464 268435456 da0p7 freebsd-swap (128G) 516433920 7340032 da0p8 freebsd-swap (3.5G) 523773952 13096960 - free - (6.2G) 536870912 2357198848 da0p9 freebsd-ufs (1.1T) 2894069760 36207375 - free - (17G) # cat /etc/fstab /dev/gpt/PBaseUFS / ufs rw,noatime 1 1 /dev/gpt/PBaseEFI /boot/efi msdosfs rw,noatime 0 0 /dev/gpt/PBaseSwp3p5 none swap sw,noauto 0 0 /dev/gpt/PBaseSwp10 none swap sw,noauto 0 0 /dev/gpt/PBaseSwp14 none swap sw,noauto 0 0 /dev/gpt/PBaseSwp16 none swap sw,noauto 0 0 /dev/gpt/PBaseSwp32 none swap sw,noauto 0 0 /dev/gpt/PBaseSwp46 none swap sw,noauto 0 0 /dev/gpt/PBaseSwp128 none swap sw,noauto 0 0 # ls -C1dF /dev/gpt/* /dev/gpt/PBaseEFI /dev/gpt/PBaseSwp10 /dev/gpt/PBaseSwp128 /dev/gpt/PBaseSwp14 /dev/gpt/PBaseSwp16 /dev/gpt/PBaseSwp32 /dev/gpt/PBaseSwp3p5 /dev/gpt/PBaseSwp46 /dev/gpt/PBaseUFS (Note that they are not symbolic links to /dev/da0p* examples.) # df -m Filesystem 1M-blocks Used Avail Capacity Mounted on /dev/gpt/PBaseUFS 1114846 219903 805754 21% / devfs 0 0 0 0% /dev /dev/gpt/PBaseEFI 244 27 217 11% /boot/efi The system uses the naming referenced in the mount, avoiding the need to ever reference a /dev/da0p* name after mounting. There are commands that can use the /dev/gpt/* naming after the mount. In fact, if I varied the number of other USB drives connected before booting, then the /dev/da?p* names for the same media could vary from boot to boot. That makes references messy to handle. Avoiding ever needing to know the /dev/da?p* name is a good thing in my view. Referencing the /dev/gpt/* names always just works when they are how the mounts work. So, going back to your example, if you mount via /dev/ufs/bar , then in my view /dev/ufs/bar should not vanish: it should stay usable notation to reference the device, matching the mount. > - and on umount /dev/gpt/bar should come back.> > Regards, > > Stéphane > > -- === Mark Millard marklmi at yahoo.com