Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Dec 2016 20:48:13 +0300
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        Ian Lepore <ian@freebsd.org>, Slawa Olhovchenkov <slw@zxy.spb.ru>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: How to safely remove rest of GTP?
Message-ID:  <071295b5-f7d8-d09b-13f9-416524a1f654@FreeBSD.org>
In-Reply-To: <1483119430.16152.83.camel@freebsd.org>
References:  <20161230124407.GN37118@zxy.spb.ru> <d79b8568-72e8-415e-4923-14e3c730267e@FreeBSD.org> <20161230164652.GO37118@zxy.spb.ru> <22d5dece-f14b-3bef-b3dd-8bb6226e0d28@FreeBSD.org> <1483119430.16152.83.camel@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 30.12.2016 20:37, Ian Lepore wrote:
>> In case when you have not valid primary header, `gpart destroy` will
>> not
>> touch first two sectors. In you case you can wipe only last sector,
>> like
>> Ian suggested, but use 'gpart destroy -F da6' instead of dd.
>>
>
> If you gpart destroy -F da6 won't that also clear the valid MBR at the
> start of the disk?  I think Slawa needs to preserve that.

As I said, it will not touch first two sectors, where PMBR and primary 
GPT headers are.

> I think it would be really useful if gpart recover could help with this
> somehow.  There is a valid mbr, and a partially-valid gpt (only the
> backup is valid).  So gpart recover should provide a way to recover the
> gpt by refreshing the primary gpt and the pbmr,

`gpart recover` will restore GPT using information from backup header 
and table and construct new PMBR. After that you need to write bootcode 
if needed.

> or recover the mbr by
> wiping the backup gpt.

This is what the patch does. You need to use `gpart destroy -F` to 
CORRUPTED GPT, this command will wipe last sector where GPT backup 
header is located. Since GPT is in CORRUPT state, the primary header 
will not be overwrited by this command.

When both primary and backup headers and tables are valid, `gpart 
destroy` overwites PMBR, primary and backup headers.

> I'm not sure what the syntax would be to
> specify that, though.
>
> This didn't used to be a problem until the changes that made the backup
> gpt get used automatically without any sysadmin intervention.

For some users the problem was that they could not find their GPT, that 
declares its reliability.

-- 
WBR, Andrey V. Elsukov



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?071295b5-f7d8-d09b-13f9-416524a1f654>