Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Jun 2025 12:42:44 +0200
From:      Olivier Certner <olce@freebsd.org>
To:        Odhiambo Washington <odhiambo@gmail.com>
Cc:        questions@freebsd.org
Subject:   Re: Wiping a disk partition
Message-ID:  <4201750.O2WMGSuNBG@ravel>
In-Reply-To: <CAAdA2WNwPQzaAEjn_yJEXDq9jOZeY9FgHoNNf7pjSYkNT0ztpg@mail.gmail.com>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
Hi Odhiambo,

Assuming you're using UFS, just delete and recreate the partition.  

First, ensure that you know how to recreate the partition and more importantly the filesystem exactly (if that matters), using something like:
- gpart show ada1
- gpart show -l ada1
- dumpfs -m /dev/ada1p2

Then use the steps below:
- umount /dev/ada1p2
- gpart delete -i 2 ada1
- gpart add -t freebsd-ufs ada1 (use -a, -s and other options as appropriate)
- newfs /dev/ada1p2 (assuming the previous command returned something like "ada1p2 created", may not be the case if entries in your GPT are sparse; use same parameters as reported above if relevant).

If using ZFS, you would just destroy and recreate the dataset.

This wipes all data in the common sense of the word.  In particular, it does not make any effort to protect against some malicious actor recovering some of the previously written bytes.

Regards.

-- 
Olivier Certner
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----

iQIzBAABCQAdFiEEmNCxHjkosai0LYIujKEwQJceJicFAmhb0qQACgkQjKEwQJce
JieqNQ/+KeXbLbpoEgkJVZTeF/RYthq/wZE3zLRHlXX9nDVLoCPACE5BZ4coaSks
mfPJDg7kOcfZjmDOa58NmHyYdNMLnu0jrHxE/Pj8fC6gh9n93ZPAwALhldrLkQJ9
JxvpDE27UFVkNWFhHCVgAVcRY3ItB1TvA3uWLs3g4KFf0VdzJSqvpK6kdaUMH1SE
j1zHX23LYmifbn5YzNdsA+CK6uX76DILJ11W+ybzq+KK6ppZOIvc22eXeLOk9sL9
NCg3fT9Pd8Rudk2H8tN0S4QUak896VDyiJ6c9w4VrzlXPRfQTCDexi6JOg4NHhnT
Hrs8tk14C5WONvOr4ZK1kCvYqIPwd7+JDwlhmr25MdWtzSyHYfDXZukg8xlrEcrg
MvJbjWM6NWiA1iQUI1qTeOy5OBXwcJ84gukQzrozCX/8l06570IpsUCl56rTnoJE
spUyQz9FjIWNf3uxurHImdhVllW13ezD5VpZMVx9mc3VnUTYQiMro0hbX7uW2ppP
RXdqE1W/9q/yk0sIR7aExt+myMmyDoY4cdrPrFONh/2ofMNqlBkc3MM04rZjpMi2
/woSd6KyABWsmMxtxHSeaA7jpF92GOAdCa2gX02NMv3rlIlU/+WxuQBNAXGjVaip
VGilkif1oegGmSpgDhrlKhyy34ONHiw2S9UkhkvDrTTJcIslPKw=
=NLXh
-----END PGP SIGNATURE-----
help

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