how to wipe out hard disk or partition

  • fill disk blocks with zero or random values
umount /dev/sdX
dd if=/dev/zero of=/dev/sdX bs=1M
dd if=/dev/urandom of=/dev/sdX bs=1M

filling with random values is more secure


  • fill partition blocks with zero or random values
umount /dev/sdXN
dd if=/dev/zero of=/dev/sdXN bs=1M
dd if=/dev/urandom of=/dev/sdXN bs=1M

  • add wiping task to crontab to wipe the disk at a predetermined time
vi bin/wipe-disk.sh
#!/bin/sh
#
umount /dev/sda
dd if=/dev/urandom of=/dev/sda bs=1M

chmod 755 bin/wipe-disk.sh

crontab -e 
05 14 15 12 * /root/bin/wipe-disk.sh

minute hour day-of-month month day-of-week /path/to/command

Leave a Reply

Your email address will not be published. Required fields are marked *