Private Paste

random disk erase

text · created 2026-09-01 19:05:52 · views 49
Raw
script: 

#!/bin/bash
d="$1"; n="${2:-10000}"
s=$(blockdev --getsz "$d")

for ((i=0; i<n; i++)); do
    dd if=/dev/urandom of="$d" bs=512 count=1 \
       seek=$((RANDOM * RANDOM % s)) \
       conv=notrunc status=none
done

Command: 
sudo ./damage.sh /dev/sdX 10000

This overwrites 10,000 randomly selected 512-byte sectors. Increase the number for more damage. Use the whole device, such as /dev/sdX, not /dev/sdX1. Even with many random writes, this is not a reliable sanitization method, especially for SSDs.