> For the complete documentation index, see [llms.txt](https://docs.console.zenlayer.com/welcome/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.console.zenlayer.com/welcome/bare-metal/overview/secure-erase.md).

# Secure Erase

Cryptographically erase all disks when releasing a bare metal instance, and download an auditable erasure report.

When you release a bare metal instance, you can enable secure erase. Each disk destroys its internal data encryption key, which leaves the existing data on the disk as unrecoverable ciphertext. After the erasure, a report is generated for your records or compliance audits.

The erasure tool, [cryptoerase](https://github.com/zenlayer/cryptoerase), is open source. You can review the source code of the tool version recorded in your report to verify how the erasure was performed. See "Audit the Erasure" below.

## Requirements

* The disks of the instance must support secure erase. If not, the option cannot be selected, and the console shows "The disks of this instance don't support secure erase." To handle the data on such instances, contact [support](mailto:support@zenlayer.com).
* When you release multiple instances and some of their disks don't support secure erase, the console shows "The disks of some selected instances don't support secure erase." Those instances are released normally without erasure.

## Erasure Methods

The tool picks a command based on the disk type. All methods are Cryptographic Erase at the Purge level defined in NIST SP 800-88.

| Disk Type                                                      | Command                                                                                                                                                                           |
| -------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| NVMe                                                           | Sanitize Crypto Erase                                                                                                                                                             |
| SATA SSD                                                       | ATA SANITIZE CRYPTO SCRAMBLE EXT                                                                                                                                                  |
| SAS                                                            | SCSI SANITIZE CRYPTOGRAPHIC ERASE                                                                                                                                                 |
| Disks behind a RAID controller (Dell PERC / Broadcom MegaRAID) | The controller performs the cryptographic erase if the disk supports it. Otherwise, the tool deletes the virtual disks, switches the disks to pass-through, and erases each disk. |

The tool never falls back to overwriting or zero-filling. If a disk can't be cryptographically erased, the report marks it as failed or unhandled instead of skipping it silently.

A disk passes only if both checks succeed:

1. The disk or RAID controller reports that the erasure is complete.
2. Before the erasure, the tool writes evenly spaced random marker blocks to the disk (16 by default, 1 MiB each). After the erasure, it reads them back. Every block must have changed, and none may be unreadable.

## Enable Secure Erase

Select **Enable Secure Erase** in the confirmation dialog of any of the following operations. It is not selected by default.

| Billing Method / Scenario    | Operation                                                                                                                                                                                                                        |
| ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Pay-as-you-go                | Click **Delete**, and select the option in the **Confirmation** step.                                                                                                                                                            |
| Subscription                 | Click **Unsubscribe**, and select the option in the dialog.                                                                                                                                                                      |
| Instances in the recycle bin | Click **Release** or **Destroy**, and select the option in the **Release Resources** dialog. If you selected it when deleting or unsubscribing, it is selected here by default. You can change it, and this choice takes effect. |
| Faulty instance replacement  | After the replacement, select the option in the **Release Resources** dialog when releasing the original instance.                                                                                                               |

The following operations cancel your secure erase selection. Select it again the next time you release the instance.

* Renewal
* Resubscription
* Restoring the instance from the recycle bin

## Erasure Process

1. After you select the option, the instance goes to the recycle bin, the same as a normal deletion. You can still restore it during the retention period.
2. When the instance is released (the retention period ends, or you release it manually), the erasure starts. The instance state shows "Releasing... Erasing data".
3. After the erasure succeeds, the instance is released and removed from the list. You can download the report on the **Data Security** page.

Billing and quota:

* Billing stops when the release starts. The erasure incurs no charges.
* The instance counts toward your quota until the erasure finishes.

If the erasure fails or partially fails, the instance state shows "Data erasure failed. Manual handling in progress." or "Data erasure partially failed. Manual handling in progress." The instance stays in the releasing state and can't be operated. Our engineers will handle it, and the instance is released automatically afterward.

## Download the Erasure Report

1. Go to **Bare Metal** > **Security** > **Data Security**.
2. Search by **Report ID / Instance ID**, or filter by **Erasure Result** (Completed / Partially completed / Failed).
3. In the **Actions** column of the record, click **Download** to get the PDF report.

The report file is named `SecureEraseReport_{instance ID}_{date}.pdf`, where the date is when you selected secure erase. Records whose erasure result is **Failed** can't be downloaded.

The report contains the following sections. All times recorded by the tool are in UTC.

| Section          | Content                                                                                                                |
| ---------------- | ---------------------------------------------------------------------------------------------------------------------- |
| Summary          | Report ID, instance ID, server ID, requested / started / finished time, overall result, mode, erasure tool and version |
| Server           | Manufacturer, model, serial number, hostname, kernel                                                                   |
| Drives           | Device, model, WWID, capacity, action, and result of each disk                                                         |
| RAID reset       | Deleted virtual disks, disks switched to pass-through, and commands run (only when RAID was reset)                     |
| Erasure policy   | Policy used for the erasure, such as the number of marker blocks and firmware rules                                    |
| Tool environment | Tool name, version, Go runtime, NVMe / ATA backend, report schema version                                              |

## Audit the Erasure

cryptoerase is open source under the Apache License 2.0: <https://github.com/zenlayer/cryptoerase>.

1. **Find the source code**: The **Version** in the report's **Tool environment** section (for example, `0.8.2`) matches the repository tag `v0.8.2`.
2. **Check the result of each disk**: The result values in the report mean the following.

   | Value           | Meaning                                                                    |
   | --------------- | -------------------------------------------------------------------------- |
   | `PASS` (Passed) | Cryptographically erased and passed both checks above                      |
   | `FAIL` (Failed) | Could not be erased, or the erasure did not take effect                    |
   | `UNHANDLED`     | Can't be handled by cryptographic erase, such as an HDD without encryption |
   | `SKIPPED`       | Removable media, USB device, or no media; skipped                          |
3. **Verify the release files**: Each release includes `SHA256SUMS`. Verify the binary with:

   ```bash
   sha256sum -c SHA256SUMS --ignore-missing
   ```

In the repository, `docs/how-it-works.md` explains the erasure flow, and `docs/report.md` describes the report fields and how they map to NIST SP 800-88.

## Subuser Permissions

| Permission                        | Purpose                                                               | Policy                    |
| --------------------------------- | --------------------------------------------------------------------- | ------------------------- |
| `bmc:dataSecurity:list`           | View erasure records                                                  | BMCInstanceReadonlyAccess |
| `bmc:dataSecurity:downloadReport` | Download erasure reports                                              | BMCInstanceReadonlyAccess |
| `bmcServer:setSecureErase`        | Set or cancel secure erase when unsubscribing a subscription instance | BMCInstanceFullAccess     |

Deleting, releasing, and replacing instances use the existing permissions.
