From owner-freebsd-questions@freebsd.org Sun Oct 16 05:22:09 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B3E2CC13801 for ; Sun, 16 Oct 2016 05:22:09 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx01.qsc.de (mx01.qsc.de [213.148.129.14]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4E8C5C2B for ; Sun, 16 Oct 2016 05:22:08 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from r56.edvax.de (port-92-195-117-205.dynamic.qsc.de [92.195.117.205]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx01.qsc.de (Postfix) with ESMTPS id E1CC33CD82; Sun, 16 Oct 2016 07:21:59 +0200 (CEST) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id u9G5Lx3M002066; Sun, 16 Oct 2016 07:21:59 +0200 (CEST) (envelope-from freebsd@edvax.de) Date: Sun, 16 Oct 2016 07:21:59 +0200 From: Polytropon To: "Jason C. Wells" Cc: freebsd-questions@freebsd.org Subject: Re: Filesystem Label Ambiguity Message-Id: <20161016072159.9d252d6f.freebsd@edvax.de> In-Reply-To: References: <86pon1dwze.fsf@WorkBox.Home> Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 05:22:09 -0000 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, ...