From nobody Wed Sep 27 12:40:58 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RwbnQ6RrCz4vPdg; Wed, 27 Sep 2023 12:40:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RwbnQ612Qz4Qby; Wed, 27 Sep 2023 12:40:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1695818458; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Bu2nb/x6wW6lAnt370nV1XgssgPAmOEN9KrqJMUT9Ac=; b=lyq+2yyUKH9Hx70Q+l2LSaVbOZzj4OBWwhYszM7yesvlab3B4m5+2DLIIXdVVkTDxxahAQ 36fz1dPW7/YiaVbNrFGW1AMGj30TOlWclU8k23Tez3Zcc+81FBBKbsOiNuAdi+reX8/chs Kwzdy0oibsgoQj42ZAnGW+K6evqufcXmRhX6nvxV6aFnWT4GMvwMIufLRT7VmC3MJ7qHJ4 GKbnqJJm4+PrSSRHHRzdstN2grFeW6AvYE1EsMmJS0Gl9FliWNMLztejr52fAwc8GbUe1k GWBur5jL/Cwsp9hJ5XLrhtoJX4bMF/uw+GV/VohMma7jFNNn+K7/GcydwWnEWg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1695818458; a=rsa-sha256; cv=none; b=A6qB9FHuFVCWxuMi3OS949Sj4VRQAn9F/b/shukafaUQNMEFxqVTGN3lpzo8cPJuow9nvZ rYqSpyfETIbe5ftqu28SQpShqlpwXuVPozlk5EDhMd9pwcLuVaH3ih/X0y0brfz37hXFJQ 81Nf6hBDneaRky8S1qTxCy45w57IRax+K8S9abj2oKNFVNeNuVOjvEwU9L00Bp5BSNSK18 4jFj2oRiZ9tlRZL0NinrMsk0aH2mb6fU695sqsQNTPahaKwSkbA7XOFKSdVIi/rK1y4F1I aI4jegYCPTTHgO61g8FEPBxty8t0zJmvDFFO7NJMEp2JjK2ofwIa4JM1436F5Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1695818458; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Bu2nb/x6wW6lAnt370nV1XgssgPAmOEN9KrqJMUT9Ac=; b=NOihGuMyq34kmdnm9jU+NsFsS4f/BBcgAEG7UpUEpama06ek5xbKwr4OlzYCZ5qTWBgdYx cka3yZTj2vc/mw57s1WpcQ2vIdoAIcy+0ONMZu+MumD0TVTXTFN8nzwufmac8tq0woJAtR XbZgssJM/nXI7P3N6RBWQtFxyuppzMAEf2s1Mg0ROv87NB7LReXMlPA9o/pvvK8EI0KgPr fTmjrE3myEru/hwaucSANb/LBlt1bir9VTdnd2Hp0xw7IXEF08T0/z3YsJ/WptyBuyueal 4RTsaQx2p82MMq8TzuNI+PAHP7XBUbOw6HI358KJN+mnJ6uIynv6ZErPlghjxQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RwbnQ5448zg5l; Wed, 27 Sep 2023 12:40:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 38RCewTj001068; Wed, 27 Sep 2023 12:40:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38RCewW3001066; Wed, 27 Sep 2023 12:40:58 GMT (envelope-from git) Date: Wed, 27 Sep 2023 12:40:58 GMT Message-Id: <202309271240.38RCewW3001066@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 81f36fbc98dd - main - glabel.8: Warn against using generic labels on a shared device List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 81f36fbc98dd74ca923938e0329919d426811b0c Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=81f36fbc98dd74ca923938e0329919d426811b0c commit 81f36fbc98dd74ca923938e0329919d426811b0c Author: Mark Johnston AuthorDate: 2022-05-26 13:48:17 +0000 Commit: Mark Johnston CommitDate: 2023-09-27 12:39:31 +0000 glabel.8: Warn against using generic labels on a shared device Also suggest against creating a generic label on a device which already contains a filesystem. PR: 264166 Reviewed by: imp, delphij, Pau Amma MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D35326 --- lib/geom/label/glabel.8 | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/lib/geom/label/glabel.8 b/lib/geom/label/glabel.8 index 5283a604e45b..a23f425bc5e1 100644 --- a/lib/geom/label/glabel.8 +++ b/lib/geom/label/glabel.8 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd March 12, 2017 +.Dd September 27, 2023 .Dt GLABEL 8 .Os .Sh NAME @@ -141,6 +141,26 @@ Generic labels created and managed solely by are created in the .Pa /dev/label/ directory. +Note that generic, automatic labels occupy some space on the device +and thus should not be added to a device already containing a file system. +In particular, +.Nm +reserves the last sector of the device to store the label information. +If the device already contains a file system, +.Nm +will overwrite the last sector, possibly damaging the file system, and the +file system may later overwrite the label sector. +Instead, create a label before initializing the file system, and initialize +that file system on the device created by +.Nm +under the +.Pa /dev/label/ +directory. +Then the file system will correctly account for the space occupied by the +generic label, +since the +.Nm +device will be one sector smaller than the device from which it was created. .Pp Note that for all label types, nested GEOM classes will cause additional device nodes to be created, with context-specific data appended to their