Re: gpart destroy, in depth

From: Warner Losh <imp_at_bsdimp.com>
Date: Tue, 11 Apr 2023 13:24:57 UTC
It writes zeros to the partition table.

Warner

On Tue, Apr 11, 2023, 7:13 AM Graham Perrin <grahamperrin@freebsd.org>
wrote:

> Please: what, exactly, occurs when a partition table is destroyed by
> gpart(8)?
>
> Background: a customer was 100% certain that no data was required from a
> hard disk in an iMac that will be disposed of. I booted from a USB drive
> with FreeBSD 14.0-CURRENT, then lazily ran gpart destroy for the
> internal disk (probably ada0). A few hours later, the customer realised
> that the disk probably held a few years' worth of important emails.
>
> I don't intend to attempt recovery, or recreation of the partition
> table, but I'd like to provide enough technical information for a third
> party to advise the customer whether doing so will be economically viable.
>
> (I see files such as lib/geom/part/geom_part.c and
> sys/geom/part/g_part.c, but I have no idea how to interpret them.)
>
> Thanks
>
> <
> https://github.com/freebsd/freebsd-src/blob/main/lib/geom/part/geom_part.c
> >
>
> <https://github.com/freebsd/freebsd-src/blob/main/sys/geom/part/g_part.c>
>
>