#!/bin/bash ## fill empty space with nulls to really delete everything sfdisk -d /dev/sda \ | awk '/^.dev.sd/ {print $1}' \ | while read d; do mkdir -p /mnt/x mount $d /mnt/x ls -l /mnt/x echo "writing nulls to free space on $d ..." time cat /dev/zero > /mnt/x/zeroes sync rm /mnt/x/zeroes umount /mnt/x done echo OK