From nobody Wed Oct 04 13:43:38 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 4S0wrW1VDxz4vxYp; Wed, 4 Oct 2023 13:43:39 +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 4S0wrW13hPz3Yfh; Wed, 4 Oct 2023 13:43:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696427019; 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=5byqIyyg53WnMmbqRabjQjwqr+UARw7E5shuTbU+QTI=; b=M6llblw7pSlIcL+tt+OD/PtXkJrpAzehO3okkH+3iy/CUv6wx8zbwdivaHhHc71pmHKYxe w7O0np7n8T3QRmaxRmvr6ovnffA4DW0VizSxkfZWTHuusLtcWQngMgLOPNWTwBMnCmgd+L STDsk4bNO2GEvoxZUtn/tR7HPOngurlIizpdd+SbhP9blvPDZBllNIGmzGA+nsfeVGOHiW 31S9McpGqUlOp9SOinzvOjtX/X2yo+ayj7RKFlLmnmtcA02n4lYZ8l87YtQDpTDMg7qxy7 r7HkXpvGjj2IFTndpop6tZf48QckCsGg/E1dU4e5s7kDpkaunB5XTtCE7KxeYQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696427019; a=rsa-sha256; cv=none; b=VOgzucAx2G65Z3KMnjVkWeS8fsk68rokOUTCqzr6Z0Gf8SPecpXXtLTSgXPeCkVB0KGPti TrWIyRgvda/sU4WqD7HGt5FfGzETCPpglBwpCnKUPezp8AkhIZowg0M8jSooBo04TO8uLJ ha3WhsETyLjd+A0fvLnRmK8UmvNEboRYRz+Rn5kdqIkToJp6+SfXi1BknCJnK27Q1xRHdm ufKRTOlXPS7A8d+3h5jI9xAkVJjg3nA6CaQvqOOZ4kzoJY9RPFcuk6GFMFJyGPrRgwynj4 ZShTDwUjaDGiDKFmVVb1m2ytbilWs9prmi+iZsbhNHTx6dW1ibJNi+8Yppoo5A== 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=1696427019; 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=5byqIyyg53WnMmbqRabjQjwqr+UARw7E5shuTbU+QTI=; b=TxHVTK3jtAdt5fsr2hyeSek6VZWiNA5c9vId6nVZOwPfWXsF0GBSmNestXnkqUeCe7y+TZ G75sQe/iGnH/vfdXjiWOwzNxqoXZv0DfEEgPCr87IgIfErw/N3hTqQXMWtnNGJqXmu8X63 /GTByYzGrf/8/vfTLDrNQNiQjsj8Y1k6Vhi0XLbX1J5kupg0UM6TGRkrvGIzyeSsJ6KrFX IxYm7Lu+D1g9o1NyKiV2kzhiVK4ZRRBPX8Zdapm+mJ0EMy3fBTyG1Zyk+I7kK3txFg362F xJD/Qqdi3F/2a3+mlO3ajy12ULEpHDPVhiediBjL4rKcxG5DQlkFWFfJYpmwOw== 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 4S0wrW08CmzgB5; Wed, 4 Oct 2023 13:43:39 +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 394DhcfE019745; Wed, 4 Oct 2023 13:43:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394DhcVE019742; Wed, 4 Oct 2023 13:43:38 GMT (envelope-from git) Date: Wed, 4 Oct 2023 13:43:38 GMT Message-Id: <202310041343.394DhcVE019742@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: 2464d8c5e296 - stable/13 - 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/13 X-Git-Reftype: branch X-Git-Commit: 2464d8c5e296a02de882310398e73077225cac00 Auto-Submitted: auto-generated The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=2464d8c5e296a02de882310398e73077225cac00 commit 2464d8c5e296a02de882310398e73077225cac00 Author: Mark Johnston AuthorDate: 2022-05-26 13:48:17 +0000 Commit: Mark Johnston CommitDate: 2023-10-04 13:43:22 +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