Filesystem Label Ambiguity

jd1008 jd1008 at
Sun Oct 16 00:22:33 UTC 2016

On 10/15/2016 05: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.
> 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.
Also you can use
sudo /sbin/e2label /dev/????  <new label>   (of course,  while unmounted).

More information about the freebsd-questions mailing list