From nobody Wed Oct 4 13:43:45 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 4S0wrd6Ddzz4vxqw; Wed, 4 Oct 2023 13:43:45 +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 4S0wrd5jxqz3Ysj; Wed, 4 Oct 2023 13:43:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696427025; 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=vsfwIJ/vMpctys7mlcxneyq+o1hbK+OFVags1MF3gAM=; b=M6vgbdXSILCBe/00SV5vGi1RKvVjU2YbIyXt4AbSZBwR8RfXg/iIiyvTRDmAIVJFx1Rfom Ao5M7VioqLMIdPaEk0MrDDgsJpmqydcKojyF5BpBzskSlSUx5hwgGolN2CbZqLvB6OPwnK 9soKQt2FIFvSYkd00roiRRcCpdBBbZ3BTV5HXjmXZjOqIDl6609an15hqIuqjwV+LGAOBD fF4cnP95l6FWQLe2s7vkcsFHDpB3c2Kbk23WlKr5oFfRXf6wA8NiPQxNPkp6s8pwvy5Gp5 oRSbPi9fjuXBwoID/G8W/0CvMJzXm2FP8Jp3l2JJV54xwQFztvDycnLnS936+g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696427025; a=rsa-sha256; cv=none; b=QpxrjVML1vrYEyHxDWnr0ksVzOodRzRJdQKPq4VaiFeLw/NdcEeZkj8x8X3Hv9kgFMrxwH W9DNAZ03QtF9CkihVfKPw/5G+3yxmZ5Z9yw3cHTSDKsJCHAVDS3OciViSGLnO2yzE2Lz6l 8nh52p9CoRnScJIOoTpD0kJRAo+tQl1CHwHw1McaOT0nyXsuS0DHBaxUaoYdlqI5ZlASRW VtRo+GBIcuBpVaPoIoYR4Vjqo3peDyRfEjsRJTgfukDWWLrZPIjv7WvMNzNGjx5Uv7CEZH 4cuXSojtuq69UxSsPOY6Z6Rlin5IX0j7IuFTZ3hxieiFgZzgzgSQv1n6ccj47w== 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=1696427025; 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=vsfwIJ/vMpctys7mlcxneyq+o1hbK+OFVags1MF3gAM=; b=w6nDXaxHDJ2Nv5Ck5GifyDKNEtvG8Dw5xVPlHZxDwOWCcgdvUmIvj+/R+V6S2FmBbPf3PL DWH8ergOGQXmRN/ye4dTUR50vMSv8ETxGNSKC2iFZrd3chf4hxgQMR9QpZ0SJ7qywgoNJs FFAB5bTB68wZ6nNok5f5864h6gKqbV5XYzqGIBeI9qq42jR4DiN/hSWs5h73RVSFq/us95 G/4VRZs3357a6jfsT47SiGMaf2UDUH2plkZcCl50uw/K+dOfKEL1sEbRAAAZKI0n3u+POj KCzRn0H8Frr0WryUsE2wJ6notxP/Rt/wFtEWGIPvkshABRXkwX3NM89BCryaTQ== 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 4S0wrd4klTzfxG; Wed, 4 Oct 2023 13:43:45 +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 394DhjXI019957; Wed, 4 Oct 2023 13:43:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394Dhj8L019954; Wed, 4 Oct 2023 13:43:45 GMT (envelope-from git) Date: Wed, 4 Oct 2023 13:43:45 GMT Message-Id: <202310041343.394Dhj8L019954@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: b11568083f09 - stable/14 - 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/stable/14 X-Git-Reftype: branch X-Git-Commit: b11568083f09f48caf11d78d25ab58fc65793bcf Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b11568083f09f48caf11d78d25ab58fc65793bcf commit b11568083f09f48caf11d78d25ab58fc65793bcf Author: Mark Johnston AuthorDate: 2022-05-26 13:48:17 +0000 Commit: Mark Johnston CommitDate: 2023-10-04 13:41:29 +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 (cherry picked from commit 81f36fbc98dd74ca923938e0329919d426811b0c) --- 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