问题原文
原帖链接 · Rino Bino · CC BY-SA 4.0
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.
社区高分解答
原帖链接 · Mircea Vutcovici · CC BY-SA 4.0
The Linux command to remove all disklabel and file systems signatures is:
wipefs -a /dev/sd###
Most modern flash disks and flash USB sticks are supporting TRIM / DISCARD / SCSI UNMAP. For USB you need to enable it:
# cat /sys/block/sd###/device/scsi_disk/*/provisioning_mode
full
# echo unmap > /sys/block/sd###/device/scsi_disk/*/provisioning_mode
# cat /sys/block/sd###/device/scsi_disk/*/provisioning_mode
unmap
#
If trim is enabled you can destroy all data with:
blkdiscard /dev/sd###
Replace sd### with something like sdx or nvme9n9. You can list all block devices with: lsblk
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
