How to safely remove rest of GTP?

Ian Lepore ian at freebsd.org
Fri Dec 30 16:41:23 UTC 2016


On Fri, 2016-12-30 at 15:44 +0300, 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 need to zero out the backup gpt header.  Geom locates that header
using (mediasize / sectorsize) - 1.  I think mediasize/sectorsize is
exactly what's displayed by diskinfo -v as "mediasize in sectors", so
that number - 1 would be lastsector in:

 dd if=/dev/zero of=/dev/da6 bs=<sectorsize> oseek=<lastsector> count=1

-- Ian


More information about the freebsd-hackers mailing list