Re: gpart destroy, in depth

From: Dmitry Morozovsky <marck_at_rinet.ru>
Date: Tue, 11 Apr 2023 13:32:47 UTC
On Tue, 11 Apr 2023, Graham Perrin 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>

I suppose sysutils/testdisk will be useful for recovering, as most of actual 
file systems are left intact


-- 
Sincerely,
D.Marck                                        [DM5020, MCK-RIPE, DM3-RIPN]
[ FreeBSD committer:                                    marck@FreeBSD.org ]
---------------------------------------------------------------------------
*** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- woozle@woozle.net ***
---------------------------------------------------------------------------