git: b11568083f09 - stable/14 - glabel.8: Warn against using generic labels on a shared device

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Wed, 04 Oct 2023 13:43:45 UTC
The branch stable/14 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=b11568083f09f48caf11d78d25ab58fc65793bcf

commit b11568083f09f48caf11d78d25ab58fc65793bcf
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-05-26 13:48:17 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
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 <pauamma@gundo.com>
    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