I used FreeBSD 12.0-RELEASE, I set label for partition refer to "Example 18.1. Labeling Partitions on the Boot Disk" in chapter 18.7. Labeling Disk Devices. In single mode, it work okay, I can see labels in /dev/label, but booted in multi-user mode, the directory /dev/label disappeared, I try "glabel status", it did not show any labels that I have set in single mode.
When partition, that has label mounted/opened for writing/etc and this is done using another name (not a label), the label's geom object becomes spoiled. Read about SPOILING in the geom(4) manual page.
What is the correct operations or step for setting a persistent label on partition?
(In reply to yuchensdgt from comment #2) I am a bit confused today, but is `gpart add -l <label> ...` what you are looking for?
I just want create a label that can be used in /etc/fstab, if I add a new hard disk, the device number maybe be changed, for example, from ada7s11 to ada8s11; if I use /dev/ada7s11 in /etc/fstab, freebsd system will be suspended, failed to statrt.
Can you tell what is accessing the disk via the non /dev/label interface? Some geoms can hardcode the label name to avoid tasting the other name. Either way, I think our current interface of randomly killing device names that lost the first-open race is definitely *a* bug. I don't know if we're tracking it in some other PR or not.
(In reply to Conrad Meyer from comment #5) my /etc/fstab is below: # Device Mountpoint FStype Options Dump Pass# /dev/ada7p12 / ufs rw 1 1 /dev/ada7p13 none swap sw 0 0 /dev/ada7p14 /var ufs rw 2 2 /dev/ada7p15 /tmp ufs rw 2 2 /dev/ada7p16 /usr ufs rw 2 2
(In reply to yuchensdgt from comment #6) Oh, yeah. That would be why the filesystem mounts (in multiuser) are obtaining non-label names and spoiling the label names. Note that later in the same example, 18.1, it presents the following fstab: # Device Mountpoint FStype Options Dump Pass# /dev/label/swap none swap sw 0 0 /dev/label/rootfs / ufs rw 1 1 /dev/label/tmp /tmp ufs rw 2 2 /dev/label/usr /usr ufs rw 2 2 /dev/label/var /var ufs rw 2 2 I recommend using the label name in fstab, as that example shows. Then the /dev/ada names will disappear, which still sucks, but at least the labels will persist. In my personal configuration I use GPT labels rather than GEOM labels, but a similar idea. # device mount fstype options dump pass /dev/gpt/freebsd-root / ufs rw,noatime 1 1 /dev/gpt/freebsd-swap none swap sw 0 0 That should resolve the immediate issue, although I would still like to see the "spoiling" of alternative labels get fixed.