erase usb stick
First of all I plug in USB stick and run dmesg
to find the attached device, for example /dev/da0
.
Then I check current partition information with gpart show /dev/da0
.
I use dd(1)
to fill the device with a bunch of zeroes.
% dd if=/dev/zero of=/dev/da0 bs=1M status=progress
To make that stick usable again it has to have a partitioning scheme and a filesystem.
Here is an example for GPT with UFS.
% gpart create -s gpt /dev/da0 % gpart add -t freebsd-ufs /dev/da0 % newfs /dev/da0p1
Ready to be used.
% mount /dev/da0p1 /media/usb # do stuff % umount /media/usb