Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Oct 2016 18:16:21 -0500
From:      Brandon J. Wandersee <brandon.wandersee@gmail.com>
To:        "Jason C. Wells" <jasoncwells@fastmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Filesystem Label Ambiguity
Message-ID:  <86pon1dwze.fsf@WorkBox.Home>
In-Reply-To: <c183f0a0-4459-228a-edb8-bcd8d393ca20@fastmail.com>
References:  <c183f0a0-4459-228a-edb8-bcd8d393ca20@fastmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

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@gmail.com
::  --------------------------------------------------
::  'The best design is as little design as possible.'
::  --- Dieter Rams ----------------------------------



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86pon1dwze.fsf>