Re: Wiping a disk partition
- Reply: Odhiambo Washington : "Re: Wiping a disk partition"
- In reply to: Tomek CEDRO : "Re: Wiping a disk partition"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 30 Jun 2025 14:47:14 UTC
On 25/06/2025 15:28, Tomek CEDRO wrote: > 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 :-) Right answer! As a refinement you might want to umount the volume first to avoid stability problems. The question was how to wipe the data on a partition. Some people have suggested secure erasing the entire drive. You cannot issue a SCSI command to erase a software defined partition that SCSI doesn't know anything about. Deleting the files or creating a new FS doesn't wipe the file contents. Without additional context, overwriting the partition with zeros is the best answer. Except... given that the partition IS mounted it presumably has 852Gb of files, and the real question might have been how to delete all the files in the /disk2 directory rather the wiping the partition- so Tomek - why do you ask? Regards, Frank.