Filesystem Label Ambiguity

Polytropon freebsd at
Sun Oct 16 05:22:09 UTC 2016

On Sat, 15 Oct 2016 16:35:31 -0700, Jason C. Wells wrote:
> On 10/15/2016 4:16 PM, Brandon J. Wandersee wrote:
> > Jason C. Wells writes:
> >
> >> Let's say I have three disks and each of them has a partition labelled
> >> "volume3" i.e.  /dev/ufs/volume3.
> >>
> >> How can I determine which of those is currently mounted?
> >>
> >> How does the system determine which of those to mount at boot time?
> > Short answer: Don't do this.
> OK. So the device renumbering problem has been traded for a naming 
> ambiguity problem.

While device names can change (order of device detection, driver
to access the drive etc.), labels are "static" attributes to the
file systems which are _user-defined_ things (independent from
the system).

An alternative is to use UFS IDs (which are also static, but do
not depend on user decisions):


The glabel(8) class supports a label type for UFS file systems,
based on the unique file system id, ufsid. These labels may be
found in /dev/ufsid and are created automatically during system
startup. It is possible to use ufsid labels to mount partitions
using /etc/fstab. Use glabel status to receive a list of file
systems and their corresponding ufsid labels:

% glabel status
                  Name  Status  Components
ufsid/486b6fc38d330916     N/A  ad4s1d
ufsid/486b6fc16926168e     N/A  ad4s1f

In the above example, ad4s1d represents /var, while ad4s1f represents
/usr. Using the ufsid values shown, these partitions may now be
mounted with the following entries in /etc/fstab:

/dev/ufsid/486b6fc38d330916        /var        ufs        rw        2      2
/dev/ufsid/486b6fc16926168e        /usr        ufs        rw        2      2

Any partitions with ufsid labels can be mounted in this way,
eliminating the need to manually create permanent labels, while
still enjoying the benefits of device name independent mounting.



> I didn't realize this when I first came upon my 
> naming convention for filesystems.  I'll start keeping track of my 
> "volumeX" names and make them unique. I just got lucky that I didn't 
> mount the wrong disks over the course of the last few weeks.

Labels have a _specific_ use that somewhat dies them to proper
decision making and "schemas", such as "color and number",
"device it is intended for", "what mountpoint it is designated
to be mounted on", "what date this system has been created" or
"what kind of data is on that partition". There are several other
considerations that make labels much more useful than traditional
device names.

> Maybe I'll just use UUIDs everywhere. Those are easy to remember. :)

Definitely, just like UFS IDs (see above). ;-)

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list