Get a Pentest and security assessment of your IT network.

Cyber Security

ATA Secure Erase: Fixing Zeroed Drives

TL;DR

If your ATA Secure Erase is filling drives with zeros instead of a proper sanitisation pattern, it’s likely due to incorrect tool usage or firmware limitations. This guide covers checking drive support, using the correct commands (hdparm/nvme-cli), and understanding potential fallback options.

Understanding ATA Secure Erase

ATA Secure Erase is a standard for permanently deleting data from hard drives and SSDs. It’s more effective than simply overwriting, as it uses the drive’s internal mechanisms to erase data securely. However, its implementation varies between manufacturers.

Step 1: Check Drive Support

  1. Identify your drive model: Use a tool like lsblk (Linux) or Disk Management (Windows).
  2. Check the manufacturer’s specifications: Visit the drive manufacturer’s website and search for documentation on ATA Secure Erase support. Some older drives may not fully support it, or have limitations.
  3. Use hdparm to query security status (Linux):
    sudo hdparm -I /dev/sda | grep 'Security'

    Look for lines indicating supported Security Erase features and their status (e.g., “Security: Supported”).

  4. For NVMe drives, use nvme-cli:
    nvme id-ctrl /dev/nvme0n1 | grep 'Secure Erase'

    This will show the supported secure erase capabilities of the drive.

Step 2: Using hdparm for Secure Erase (Linux)

If your drive supports ATA Secure Erase, use hdparm carefully.

  1. Put the drive into a frozen state: This is crucial before initiating the erase.
    sudo hdparm --user-master u --security-set-pass your_password /dev/sda

    Replace your_password with a password (required for unlocking). The password can be anything, but it’s needed to unlock the drive later.

  2. Lock the drive:
    sudo hdparm --user-master u --security-lock your_password /dev/sda
  3. Initiate Secure Erase (Enhanced): This is where problems often occur. Ensure you use the correct command.
    sudo hdparm --user-master u --security-erase your_password /dev/sda

    If this fills with zeros, try:

    sudo hdparm --user-master u --security-erase-enhanced your_password /dev/sda
  4. Unlock the drive: After the erase completes (it can take a long time!), unlock it.
    sudo hdparm --user-master u --security-unlock your_password /dev/sda

Step 3: Using nvme-cli for Secure Erase (NVMe)

  1. Identify the namespace to erase: NVMe drives have namespaces, which are logical partitions.
    nvme ls-ns /dev/nvme0n1
  2. Format the namespace for secure erase:
    sudo nvme format --namespace-id 1 --secure-erase /dev/nvme0n1

    Replace 1 with the correct namespace ID. This command initiates a secure erase operation.

Step 4: Troubleshooting Zeroed Drives

  • Firmware Bugs: Some drive firmware has bugs that cause Secure Erase to fail and fill the drive with zeros instead. Check for firmware updates on the manufacturer’s website.
  • Incorrect Command Usage: Double-check the hdparm or nvme-cli commands you are using. A small mistake can lead to unexpected results.
  • Drive Limitations: Older drives may not support a full Secure Erase, and only offer basic overwrite functionality.

Step 5: Fallback Options

If ATA Secure Erase fails or isn’t supported:

  • DBAN (Darik’s Boot and Nuke): A free, bootable tool for securely wiping drives using multiple overwrite passes.
  • Full Disk Encryption: Encrypt the entire drive before disposal. This renders the data unreadable without the encryption key.
  • Physical Destruction: The most secure method is to physically destroy the drive (e.g., shredding, degaussing).
Related posts
Cyber Security

Zip Codes & PII: Are They Personal Data?

Cyber Security

Zero-Day Vulnerabilities: User Defence Guide

Cyber Security

Zero Knowledge Voting with Trusted Server

Cyber Security

ZeroNet: 51% Attack Risks & Mitigation