I'm clearing a drive with dd
. It's a USB device and 120GB and it's taking a very long time:
dd if=/dev/zero of=/dev/da0 bs=1M status=progress
I have tried messing with the block size (smaller and larger values bs=4M
, bs=8M
, etc) but nothing seems to make much of a difference. It's writing at about 7000 kB/s
which is painfully slow.
I do not care about "securely" wiping the data I just want it wiped so I can re-establish the partition structure and filesystem from scratch. Is there an alternate way (using standard utilities) that can perform a quick (within a minute or two) wipe for this type of scenario? The device I'm working on is FreeBSD but I think the dd command (and gpart, etc) work similarly between it and Linux.
The fastest way is to remove all partitions on the drive. This will "remove" also filesystems. And
zero
first megabyte (boot record and so).and you have "brand new" disk.
There's different kinds of USB storage devices.
If your device supports it,
on Linux, or
on FreeBSD
will tell the drive to just drop all data. That's going to be very quick, as it basically is just telling the wear leveling table that "hey, forget that any of the blocks ever were used for data, and treat them as ready to be nulled and used again".
Even if it's that quick, it will have the nice side effect of "nulling", i.e. it makes the old data irrecoverable (short of opening the hardware, circumventing the storage controller inside, and reading raw data an taking a huge guess on what block in which order needs to be reassembled).
The Linux command to remove all disklabel and file systems signatures is:
Most modern flash disks and flash USB sticks are supporting TRIM / DISCARD / SCSI UNMAP. For USB you need to enable it:
If trim is enabled you can destroy all data with:
Replace
sd###
with something likesdx
ornvme9n9
. You can list all block devices with:lsblk