Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Sep 2012 16:53:10 -0700
From:      Xin Li <delphij@delphij.net>
To:        Warren Block <wblock@wonkity.com>
Cc:        freebsd-geom@freebsd.org
Subject:   Re: Simple way to clear arbitrary drive metadata?
Message-ID:  <50663866.9070001@delphij.net>
In-Reply-To: <alpine.BSF.2.00.1209281607310.20482@wonkity.com>
References:  <alpine.BSF.2.00.1209281607310.20482@wonkity.com>

next in thread | previous in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 09/28/12 15:21, Warren Block wrote:
> Last night, I found that the remnants of a GPT backup table on an
> MBR drive prevented it from booting.  When reusing drives from old
> mirrors, old mirror metadata can be a problem also.  And there may
> be old hardware RAID metadata at the end of the drive.
> 
> It would be great if dd understood negative seek values.  This
> would get most of that old metadata:
> 
> dd if=/dev/zero of=/dev/ada8 seek=-34
> 
> ...but dd does not understand negative seek values.  (Been on my
> list for a while to look at that.)
> 
> Which leaves things like
> 
> diskinfo ada8 | cut -f4 (subtract 34) dd if=/dev/zero of=/dev/ada8
> seek=(calculated value)
> 
> That can be done in one command line with bc and backticks, but
> it's not clear or elegant.  gpart can clear secondary GPT tables,
> but I'm pretty sure it won't wipe out that space unless it actually
> is a GPT table. Likewise with glabel and gmirror, they're safe
> because they only touch data they understand.
> 
> Is there something simpler and more blunt?

I think you can do:

gpart destroy -F ada8
gpart create -s gpt ada8
gpart destroy -F ada8

The second 'create' will write an empty partition table to the
secondary table.

Cheers,
- -- 
Xin LI <delphij@delphij.net>    https://www.delphij.net/
FreeBSD - The Power to Serve!           Live free or die
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBCAAGBQJQZjhmAAoJEG80Jeu8UPuzp/wIAJ9TQdwRIvfMn5zP3yMqYKIV
OvVNSUaecPaav9G7CEwApl1bQnmCSYepv6FASH65CoNyr14kioS0e8BET4s/GzQD
LhliFucVnd6X6POdyL5VEdJ78UYuox8h9elykJBSlwdgeWGCpoRwI9sG8+oWtl+Z
zpYKgUBU+eCTsXWjIBbLGphhgXgDT+j1uEks8qxbVsUNZH054tKWEQ6iK2+bKGYa
6dp3M+Lrt6qJLcKWtFvxMVP2rzCzYmRmSFkKVUiIHgSOp2yH4uFvzRo9CY74azuL
QS4/+h5iuMtnMiXKr5sWoGOi4WCTLVSnmo07ac9aP4H0jlTuVmJ/Qq/hoqOuMZg=
=ae1M
-----END PGP SIGNATURE-----



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