Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Sep 2016 13:51:54 -0700
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-current@freebsd.org
Cc:        Ngie Cooper <yaneurabeya@gmail.com>, Ernie Luzar <luzar722@gmail.com>, "Hartmann, O." <ohartman@mail.zedat.fu-berlin.de>
Subject:   Re: Destroy GPT partition scheme absolutely, how?
Message-ID:  <1785064.lgVzRW13Wf@ralph.baldwin.cx>
In-Reply-To: <5484D815-4B17-456B-BA60-CC6F4E97AFE3@gmail.com>
References:  <20160926150109.0d0d793e@hermann> <57E92726.2020605@gmail.com> <5484D815-4B17-456B-BA60-CC6F4E97AFE3@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday, September 27, 2016 12:36:22 AM Ngie Cooper wrote:
> 
> > On Sep 26, 2016, at 22:48, Ernie Luzar <luzar722@gmail.com> 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.

-- 
John Baldwin



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