Skip to content

Instantly share code, notes, and snippets.

@d0n601
Created July 2, 2018 19:21
Show Gist options
  • Save d0n601/11a91796dfd0ca466ccc8b85fde7b911 to your computer and use it in GitHub Desktop.
Save d0n601/11a91796dfd0ca466ccc8b85fde7b911 to your computer and use it in GitHub Desktop.
A really basic bash script to loop dd in order to writes random data to a disk 8 times over.
#!/bin/bash
#Basic while loop to whipe a harddisk.
# Show us the disks.
sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL
# Prompt for disk to kill.
echo What disk to you want to kill \(ex: sdb\)
read killdisk
killdisk="/dev/$killdisk"
# This can take a long time for large disks.
counter=1
while [ $counter -le 8 ]
do
sudo dd if=/dev/urandom of="$killdisk" bs=1M # Change to not be sdb
((counter++))
done
echo All done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment