Skip to content

Instantly share code, notes, and snippets.

@cjlawson02
Created March 5, 2020 04:41
Show Gist options
  • Save cjlawson02/8d1c3cea9a6124360e107e97320ffa41 to your computer and use it in GitHub Desktop.
Save cjlawson02/8d1c3cea9a6124360e107e97320ffa41 to your computer and use it in GitHub Desktop.
#! /bin/sh
echo "What disk do you want"
echo "to wipe? For example - da1 :"
read disk
echo "OK, in 10 seconds I will destroy all data on $disk!"
echo "Press CTRL+C to abort!"
sleep 10
diskinfo ${disk} | while read disk sectorsize size sectors other
do
# Delete MBR and partition table.
dd if=/dev/zero of=/dev/${disk} bs=${sectorsize} count=1
# Delete GEOM metadata.
dd if=/dev/zero of=/dev/${disk} bs=${sectorsize} oseek=`expr $sectors - 2` count=2
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment