Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Jan 2017 16:21:37 -0700 (MST)
From:      Warren Block <wblock@wonkity.com>
To:        "Andrey V. Elsukov" <bu7cher@yandex.ru>
Cc:        Slawa Olhovchenkov <slw@zxy.spb.ru>, freebsd-hackers@freebsd.org
Subject:   Re: How to safely remove rest of GTP?
Message-ID:  <alpine.BSF.2.20.1701301607510.85129@wonkity.com>
In-Reply-To: <1793b0ec-3a86-5c9a-b275-aa93cd9d230e@yandex.ru>
References:  <20161230124407.GN37118@zxy.spb.ru> <d79b8568-72e8-415e-4923-14e3c730267e@FreeBSD.org> <alpine.BSF.2.20.1701300851400.85129@wonkity.com> <1793b0ec-3a86-5c9a-b275-aa93cd9d230e@yandex.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 30 Jan 2017, Andrey V. Elsukov wrote:

> On 30.01.2017 18:55, Warren Block wrote:
>>>> GEOM: da6: the primary GPT table is corrupt or invalid.
>>>> GEOM: da6: using the secondary instead -- recovery strongly advised.
>>>> GEOM: da22: the primary GPT table is corrupt or invalid.
>>>> GEOM: da22: using the secondary instead -- recovery strongly advised.
>>>> GEOM: da6: the primary GPT table is corrupt or invalid.
>>>> GEOM: da6: using the secondary instead -- recovery strongly advised.
>>>> GEOM: da22: the primary GPT table is corrupt or invalid.
>>>> GEOM: da22: using the secondary instead -- recovery strongly advised.
>>> 
>>> You may try attached patch, I did only basic tests, so first try
>>> somewhere :)
>> 
>> I really like the idea of gpart being able to remove the secondary GPT,
>> but combining it with the existing destroy command is ambiguous.  It's
>> hard for the user to tell what will happen, and the command itself
>> implies that it will destroy all partitioning.
>
> I don't see any ambiguity here. A user sees corrupted GPT, it can only 
> destroy or recover it.

Ah, but the user might not even see it.  "I wrote an MBR to my disk 
(with some other software) and now FreeBSD says it has a corrupted GPT."

In this case, it can have a valid MBR which the user does not want to 
destroy.  So re-using the gpart destroy command for this is ambiguous. 
It's also kind of dangerous, in that when the user finally does 
understand that "destroy" doesn't really destroy all partitioning, they 
might use it expecting to only destroy the "bad" partitioning and be 
surprised because things were not like they thought and it wiped out the 
"good" partitioning.

Put another way:

`gpart destroy -F` means "destroy the GEOM unconditionally".

Adding this additional function to it makes it "destroy the GEOM, unless 
some specific condition, and then it means only destroy a part of it."

As I think I said before, the function is really needed.  It is just 
making the user interface unambiguous that is my concern.

zfs has "labelclear".  If gpart did that, along with a set amount of 
space to clear at the beginning and end of the drive, I'd be happy with 
it.  It does not need to detect the type of geom.

   gpart labelclear -F -s1m da22

to clear the first and last 1M of da22.  Maybe force the user to give 
the -F flag.  (Yes, this can be done with dd, but slowly because of 
oseeking to the end of a big drive.  And it requires math, which is both 
scary and beyond the capacity of many people to calculate.)

> It is impossible to have a corrupted GPT and some 
> other type of partition table in the same time.

Maybe when only using FreeBSD and gpart, but I'm pretty sure I've seen 
forum users who have tried some crappy other formatting tool and have 
overwritten the primary GPT with a valid MBR and left the secondary GPT 
untouched.  This only becomes obvious when they bring the disk back to a 
FreeBSD system.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.20.1701301607510.85129>