From owner-freebsd-hackers@freebsd.org Fri Dec 30 16:46:55 2016 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D49EEC965F7 for ; Fri, 30 Dec 2016 16:46:55 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 98D981C8D; Fri, 30 Dec 2016 16:46:55 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1cN0KS-000NNd-Qs; Fri, 30 Dec 2016 19:46:52 +0300 Date: Fri, 30 Dec 2016 19:46:52 +0300 From: Slawa Olhovchenkov To: "Andrey V. Elsukov" Cc: freebsd-hackers@freebsd.org Subject: Re: How to safely remove rest of GTP? Message-ID: <20161230164652.GO37118@zxy.spb.ru> References: <20161230124407.GN37118@zxy.spb.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 16:46:55 -0000 On Fri, Dec 30, 2016 at 07:28:19PM +0300, Andrey V. Elsukov wrote: > On 30.12.2016 15:44, Slawa Olhovchenkov wrote: > > How to safely remove rest of GPT? > > Disk have actual data (part of ZFS), I am don't need to destroy this > > data. > > > > 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 :) What purpose of this patch? > -- > WBR, Andrey V. Elsukov > Index: sys/geom/part/g_part_gpt.c > =================================================================== > --- sys/geom/part/g_part_gpt.c (revision 310784) > +++ sys/geom/part/g_part_gpt.c (working copy) > @@ -690,7 +690,8 @@ g_part_gpt_destroy(struct g_part_table *basetable, > * Wipe the first 2 sectors to clear the partitioning. Wipe the last > * sector only if it has valid secondary header. > */ > - basetable->gpt_smhead |= 3; > + if (table->state[GPT_ELT_PRIHDR] == GPT_STATE_OK) > + basetable->gpt_smhead |= 3; > if (table->state[GPT_ELT_SECHDR] == GPT_STATE_OK && > table->lba[GPT_ELT_SECHDR] == pp->mediasize / pp->sectorsize - 1) > basetable->gpt_smtail |= 1; > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"