#!/bin/dash # USAGE: erase-disk.sh # Must be run as root echo "# Securely erasing the disk device $2" i=1 while [ $i -le $1 ]; do [ $i -eq 1 ] && if="/dev/urandom" || if="/dev/zero" echo "\n- Begin pass $i with $if" dd if="$if" of="$2" status="progress" echo "- Syncing I/O" sync i=$(( i + 1 )) done