Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Feb 2025 11:48:20 +0000
From:      Frank Leonhardt <freebsd-doc@fjl.co.uk>
To:        questions@freebsd.org
Subject:   Re: GPT secondary corrupt. Is dd'ing the first 40 sectors as a backup sufficient?
Message-ID:  <e9266bce-67ba-4657-aa93-494e64e7c8ff@fjl.co.uk>
In-Reply-To: <e26bb5cc-f0fb-4342-9448-468f0ec5a0c4@heuristicsystems.com.au>
References:  <e26bb5cc-f0fb-4342-9448-468f0ec5a0c4@heuristicsystems.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
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.





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?e9266bce-67ba-4657-aa93-494e64e7c8ff>