Write Write nulls to free space of all partitions on /dev/sda
#!/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
disk=/dev/sdx image=/mnt/temp/sdx.img log=/mnt/temp/ddrescue-sdx.log # first pass ddrescue -f -n $disk "$log" "$image" "$log" # now retry harder ddrescue -d -f -r3 $disk "$log" "$image" "$log"
Options: