Filesystem Label Ambiguity

Brandon J. Wandersee brandon.wandersee at
Sat Oct 15 23:16:31 UTC 2016

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.

Long answer: The only thing I can think of is to check
/dev/diskid/*. The one filesystem that *does not* have a node
/dev/diskid/* will be the one that's mounted. Of course you'd then have
to figure out what the ID number of each disk/partition is, which is
exactly what unique partition/filesystem labels were invented to avoid.

If this more than hypothetical, and you have filesystems that already
have labels, they can be changed by running `tunefs -L <label>` on the
unmounted partition.

As for your second question, I'm pretty sure the one that will be
mounted if you run mount(8) or put an entry in /etc/fstab will be
whichever was first detected on start-up.

::  Brandon J. Wandersee
::  brandon.wandersee at
::  --------------------------------------------------
::  'The best design is as little design as possible.'
::  --- Dieter Rams ----------------------------------

More information about the freebsd-questions mailing list