From owner-freebsd-current@freebsd.org Tue Oct 4 12:23:34 2016 Return-Path: Delivered-To: freebsd-current@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 F15DDAF4C2C for ; Tue, 4 Oct 2016 12:23:34 +0000 (UTC) (envelope-from wblock@wonkity.com) Received: from wonkity.com (wonkity.com [67.158.26.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "wonkity.com", Issuer "wonkity.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id C198CDA6; Tue, 4 Oct 2016 12:23:34 +0000 (UTC) (envelope-from wblock@wonkity.com) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.15.2/8.15.2) with ESMTPS id u94CNR6U011987 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 4 Oct 2016 06:23:27 -0600 (MDT) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.15.2/8.15.2/Submit) with ESMTP id u94CNQnq011984; Tue, 4 Oct 2016 06:23:26 -0600 (MDT) (envelope-from wblock@wonkity.com) Date: Tue, 4 Oct 2016 06:23:26 -0600 (MDT) From: Warren Block To: John Baldwin cc: freebsd-current@freebsd.org, Ngie Cooper , Ernie Luzar , "Hartmann, O." Subject: Re: Destroy GPT partition scheme absolutely, how? In-Reply-To: <1785064.lgVzRW13Wf@ralph.baldwin.cx> Message-ID: References: <20160926150109.0d0d793e@hermann> <57E92726.2020605@gmail.com> <5484D815-4B17-456B-BA60-CC6F4E97AFE3@gmail.com> <1785064.lgVzRW13Wf@ralph.baldwin.cx> User-Agent: Alpine 2.20 (BSF 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (wonkity.com [127.0.0.1]); Tue, 04 Oct 2016 06:23:27 -0600 (MDT) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2016 12:23:35 -0000 On Mon, 26 Sep 2016, John Baldwin wrote: > On Tuesday, September 27, 2016 12:36:22 AM Ngie Cooper wrote: >> >>> On Sep 26, 2016, at 22:48, Ernie Luzar wrote: >> >> ... >> >>> This little script has been posted before. Maybe it will be what your looking for. Called gpart.nuke >>> >>> #! /bin/sh >>> echo "What disk do you want" >>> echo "to wipe? For example - da1 :" >>> read disk >>> echo "OK, in 10 seconds I will destroy all data on $disk!" >>> echo "Press CTRL+C to abort!" >>> sleep 10 >>> diskinfo ${disk} | while read disk sectorsize size sectors other >>> do >>> # Delete MBR and partition table. >>> dd if=/dev/zero of=/dev/${disk} bs=${sectorsize} count=1 >>> # Delete GEOM metadata. >>> dd if=/dev/zero of=/dev/${disk} bs=${sectorsize} oseek=`expr $sectors - 2` count=2 >>> done >> >> Why not just use "gpart destroy -F provider"? > > That doesn't always work. In particular, if a disk was partitioned with GPT > and then you use normal MBR on it afterwards, the 'gpart destroy -F' of the > MBR will leave most of the GPT intact and the disk will come up with the old > GPT partitions, not as a raw disk. Right. So do a gpart destroy -F of whatever is on there, ignoring errors, then a gpart create -s gpt. Now there is definitely a secondary GPT, and a final gpart destroy -F removes it cleanly.