Disk wiping

From Notes to self
Revision as of 15:40, 20 September 2014 by Verbovet (talk | contribs)
Jump to navigation Jump to search
  • To wipe an HDD by writing zeros to it:
# dd if=/dev/zero of=/dev/sdX iflag=nocache oflag=direct bs=4M
The average speed is above 100 MB/s, so 1 TB takes about 2-3 hours.
To print transfer statistics (to stderr):
# killall -USR1 dd
  1. Make sure the drive is not frozen, support "enhanced erase" and hdparm prints "[number]min for SECURITY ERASE UNIT":
    # hdparm -I /dev/sdX
    [...]
    Security:
    Master password revision code = 65534
    supported
    not enabled
    not locked
    not frozen
    not expired: security count
    supported: enhanced erase
    3min for SECURITY ERASE UNIT. 3min for ENHANCED SECURITY ERASE UNIT.
    [...]
  2. Set a user password (this password will be cleared on the next step, so the exact choice does not matter):
    # hdparm --user-master u --security-set-pass foo /dev/sdX
  3. Issue the ATA Secure Erase command:
    # hdparm hdparm --user-master u --security-erase foo /dev/sdX