Re: Wiping a disk partition

From: Tomek CEDRO <tomek_at_cedro.info>
Date: Wed, 25 Jun 2025 14:28:22 UTC
On Wed, Jun 25, 2025 at 12:18 PM Odhiambo Washington <odhiambo@gmail.com> wrote:
>
> I have this:
> ```
> root@gw:/home/wash # df -h
> Filesystem     Size    Used   Avail Capacity  Mounted on
> /dev/ada0p2    1.8T    552G    1.1T    33%    /
> devfs          1.0K      0B    1.0K     0%    /dev
> fdescfs        1.0K      0B    1.0K     0%    /dev/fd
> procfs         8.0K      0B    8.0K     0%    /proc
> linprocfs      8.0K      0B    8.0K     0%    /compat/linux/proc
> linsysfs       8.0K      0B    8.0K     0%    /compat/linux/sys
> /dev/ada1p2    1.8T    856G    802G    52%    /disk2
> ```
>
> What is the fastest way to wipe all data on /dev/ada1p2?

The fastest way would be to overwrite partition with zeros:

dd if=/dev/zero of=/dev/ada1p2 bs=1g status=progress

In order to overwrite data safely so these are not easily recovered
you can use /dev/random in several overwrite loops, then in the last
iteration you can use /dev/zero to mark partition clean (or leave
random data for someone to wonder). Note /dev/random is much slower
than /dev/zero.

You may also use badblocks utility in destructive-write test to
overwrite with different patterns and check disk condition at the same
time but this will be slowest solution :-)

https://man.freebsd.org/cgi/man.cgi?query=badblocks

Have fun :-)

-- 
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info