Date: Sun, 16 Oct 2016 07:21:59 +0200 From: Polytropon <freebsd@edvax.de> To: "Jason C. Wells" <jasoncwells@fastmail.com> Cc: freebsd-questions@freebsd.org Subject: Re: Filesystem Label Ambiguity Message-ID: <20161016072159.9d252d6f.freebsd@edvax.de> In-Reply-To: <f671cbe9-88f1-8161-a47a-62077dca77e4@fastmail.com> References: <c183f0a0-4459-228a-edb8-bcd8d393ca20@fastmail.com> <86pon1dwze.fsf@WorkBox.Home> <f671cbe9-88f1-8161-a47a-62077dca77e4@fastmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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): *quote* 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. *unquote* Source: https://www.freebsd.org/doc/handbook/geom-glabel.html > 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). ;-) -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20161016072159.9d252d6f.freebsd>