Date: Tue, 4 Oct 2016 11:53:23 -0700 From: Maxim Sobolev <sobomax@freebsd.org> To: John Baldwin <jhb@freebsd.org> Cc: Warren Block <wblock@wonkity.com>, FreeBSD Current <freebsd-current@freebsd.org>, 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: <CAH7qZfs69tevawjjNw%2BfFkghVCvpGrC7128RV0%2BHTSa4dwLxZg@mail.gmail.com> In-Reply-To: <16661613.eI4FiDRTSB@ralph.baldwin.cx> References: <20160926150109.0d0d793e@hermann> <1785064.lgVzRW13Wf@ralph.baldwin.cx> <alpine.BSF.2.20.1610040620250.9819@wonkity.com> <16661613.eI4FiDRTSB@ralph.baldwin.cx>
next in thread | previous in thread | raw e-mail | index | archive | help
For the whole disk destruction, hopefully one day we'd have BIO_DELETE coalesce code, so that you can batch of lot of operations into handful SATA commands. I've heard rumours imp@ was doing something along those lines. As well as SSD disks smart enough to process those requests in the background. Anyway, just saying. ) -Max On Tue, Oct 4, 2016 at 10:24 AM, John Baldwin <jhb@freebsd.org> wrote: > On Tuesday, October 04, 2016 06:23:26 AM Warren Block wrote: > > 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 <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. > > > > 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. > > It is usually simpler to just dd zeroes over the first N and last N > sectors. > The only fool-proof way to ensure you don't have dangling tables in the > middle of the disk is to zero the entire disk, but that takes too long. > > -- > John Baldwin > _______________________________________________ > freebsd-current@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org" > >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAH7qZfs69tevawjjNw%2BfFkghVCvpGrC7128RV0%2BHTSa4dwLxZg>