From nobody Fri Feb 21 11:48:20 2025 X-Original-To: questions@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 4YzpL03nkRz5pgDV for ; Fri, 21 Feb 2025 11:48:24 +0000 (UTC) (envelope-from freebsd-doc@fjl.co.uk) Received: from bs1.fjl.org.uk (bs1.fjl.org.uk [84.45.41.196]) by mx1.freebsd.org (Postfix) with ESMTP id 4YzpKz3R0Hz3pdK for ; Fri, 21 Feb 2025 11:48:23 +0000 (UTC) (envelope-from freebsd-doc@fjl.co.uk) Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of freebsd-doc@fjl.co.uk designates 84.45.41.196 as permitted sender) smtp.mailfrom=freebsd-doc@fjl.co.uk Received: from [192.168.1.109] (host109-145-165-105.range109-145.btcentralplus.com [109.145.165.105]) (authenticated bits=0) by bs1.fjl.org.uk (8.14.4/8.14.4) with ESMTP id 51LBmLRX082545 for ; Fri, 21 Feb 2025 11:48:21 GMT (envelope-from freebsd-doc@fjl.co.uk) Message-ID: Date: Fri, 21 Feb 2025 11:48:20 +0000 List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: freebsd-questions@freebsd.org Sender: owner-freebsd-questions@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: GPT secondary corrupt. Is dd'ing the first 40 sectors as a backup sufficient? Content-Language: en-GB To: questions@freebsd.org References: From: Frank Leonhardt In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spamd-Result: default: False [-2.32 / 15.00]; RBL_SENDERSCORE_REPUT_9(-1.00)[84.45.41.196:from]; SUBJECT_ENDS_QUESTION(1.00)[]; NEURAL_HAM_SHORT(-1.00)[-0.996]; NEURAL_HAM_MEDIUM(-0.75)[-0.747]; NEURAL_HAM_LONG(-0.57)[-0.574]; R_SPF_ALLOW(-0.20)[+ip4:84.45.41.196:c]; ONCE_RECEIVED(0.20)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_NO_TLS_LAST(0.10)[]; RCVD_COUNT_ONE(0.00)[1]; ASN(0.00)[asn:25577, ipnet:84.45.0.0/17, country:GB]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; R_DKIM_NA(0.00)[]; MLMMJ_DEST(0.00)[questions@freebsd.org]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[questions@freebsd.org]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DMARC_NA(0.00)[fjl.co.uk]; RCPT_COUNT_ONE(0.00)[1] X-Rspamd-Queue-Id: 4YzpKz3R0Hz3pdK X-Spamd-Bar: -- On 20/02/2025 23:50, Dewayne Geraghty wrote: > I have a full disk gmirror on 12.4 using the MBR scheme.  As I'm > migrating to 14.2S and would like to use GPT scheme, so to my questions: > > 1. Is there a sysctl, or flag (somewhere) to disable > " the secondary GPT table is corrupt or invalid." > notifications?  And the fear-inspiring > # gpart show md0 > =>   40  32688  md0  GPT  (16M) [CORRUPT] > > 2. To recover a damaged primary partition, is it sufficient to restore > from a dd of the first 40 sectors of the disk, taken after disk setup > (formatting and labelling the disk)? > > 3. Is the partition header written to without my involvement?  (eg is > the clean bit set/stored in the primary or a "sub-"partition (p*)?) > > I'm sorry if my language is a bit clumsy I'm used to slices and > partition. > > Cheers, Dewayne > PS Sadly ZFS doesn't support labels (re MAC_[MLS,BIBA]) Been there, done that, got the T-shirt. https://blog.frankleonhardt.com/2017/zfs-is-not-always-the-answer-bring-back-gmirror/ My conclusion (as described) is to stick with MBR or BSDlabels, but you can (could?) use gmirror to mirror a partition rather than the whole disk. In other words, use GPT on your two drives, partition them up with a "freebsd" partition inside the GPT and just mirror the partition.  You can also hack geom_mirror.c (or thereabouts) - I think I did once but I forgot exactly how. In production use I decided not to mess about. MBR/gmirror/UFS2 when appropriate (e.g. for databases) and ZFS mirror for everything else. As to questions two and three I'm saying nothing until I've tested it! All I will say is when recovering a corrupt disk dd it as an image and play with the image. I'll keep an eye on this thread in case experiments are called for as I current have a "disk lab" going. Regards, Frank.