Skip to content

Secure-Erase method option for supported ATA and NVMe devices#687

Open
Knogle wants to merge 6 commits intomartijnvanbrummelen:masterfrom
Knogle:secure-erase-method
Open

Secure-Erase method option for supported ATA and NVMe devices#687
Knogle wants to merge 6 commits intomartijnvanbrummelen:masterfrom
Knogle:secure-erase-method

Conversation

@Knogle
Copy link
Contributor

@Knogle Knogle commented Nov 26, 2025

This commit introduces a new wipe method named "Secure Erase", integration drive-internal sanitization facilities across ATA and NVMe devices. The method implements a unified workflow:

1. Detet the drive type (ATA, SAS-over-ATA, NVMe)
2. Execute a hardware-level secure erase operation using the appropriate system toolging: - ATA/SAS: hdparm --security-erase
       - NVMe:    nvme format -s1
3. Perform a full-device verification pass to confirm that the media reads
   back as all zeros after the hardware erase has completed.
  • New method function: nwipe_secure_erase()

  • New method label and GUI integration (“Secure Erase (ATA/NVMe)”)

  • CLI method selection via: --method=secure_erase

  • Real secure erase execution implemented for:

    ATA / SATA / SAS (ATA pass-through) Using: hdparm --yes-i-know-what-i-am-doing --user-master u --security-erase NULL <device>

    NVMe namespaces Using: nvme format <device> -s1

    These operations are invoked through system() on glibc systems and expect the presence of hdparm(8) and nvme(1) in the user’s PATH.

After completion of the hardware secure erase operation, nwipe performs a full-device verification pass:

  • a single “zero pattern” is defined (0x00)

  • nwipe_static_verify() is executee GUI progress correctly displays the single verification phase

  • Verification guarantees that the device reports a post-erase all-zero state

  • If the device type is unsupported, Secure Erase fails early with a clear log message, preventing accidental misuse.

  • If hdparm/nvme report an error or return a non-zero exit status, the method aborts before verification.

  • system() invocation failures (INSUFFICIENT MEMORY, missing /bin/sh, PATH errors, etc.) are treated as hard failures.

  • All secure erase steps and verification steps include detailed logging.

The helper functions are structured such that direct ATA taskfile commands or direct NVMe admin commands (NVME_IOCTL_ADMIN_CMD, NVME_IOCTL_IO_CMD) can be added later without modifying the high-level workflow of nwipe_secure_erase().

…ating

drive-internal sanitization facilities across ATA and NVMe devices. The method
implements a unified workflow:

    1. Detect the drive type (ATA, SAS-over-ATA, NVMe)
    2. Execute a hardware-level secure erase operation using the appropriate
       system tooling:
           - ATA/SAS: hdparm --security-erase
           - NVMe:    nvme format -s1
    3. Perform a full-device verification pass to confirm that the media reads
       back as all zeros after the hardware erase has completed.

This aligns nwipe’s functionality with modern storage devices that provide
dedicated sanitization mechanisms far more reliable and performant than
software overwrites.

- New method function: `nwipe_secure_erase()`
- New method label and GUI integration (“Secure Erase (ATA/NVMe)”)
- CLI method selection via: `--method=secure_erase`
- Help text updated to reflect the new method
- Infrastructure added for automatic method-to-label mapping
- Real secure erase execution implemented for:

  **ATA / SATA / SAS (ATA pass-through)**
  Using:
      `hdparm --yes-i-know-what-i-am-doing --user-master u --security-erase NULL <device>`

  **NVMe namespaces**
  Using:
      `nvme format <device> -s1`

  These operations are invoked through `system()` on glibc systems and expect
  the presence of `hdparm(8)` and `nvme(1)` in the user’s PATH.

After completion of the hardware secure erase operation, nwipe performs a
full-device verification pass:

- a single “zero pattern” is defined (`0x00`)
- `nwipe_static_verify()` is executed with full progress tracking
- GUI progress correctly displays the single verification phase
- Verification guarantees that the device reports a post-erase all-zero state

- If the device type is unsupported, Secure Erase fails early with a clear
  log message, preventing accidental misuse.
- If hdparm/nvme report an error or return a non-zero exit status, the method
  aborts before verification.
- system() invocation failures (INSUFFICIENT MEMORY, missing /bin/sh,
  PATH errors, etc.) are treated as hard failures.
- All secure erase steps and verification steps include detailed logging.

- The secure erase helper functions are:
      `nwipe_execute_ata_secure_erase()`
      `nwipe_execute_nvme_secure_erase()`
- Each helper contains full English-language documentation and describes the
  rationale for not re-implementing low-level ioctl-based ATA/NVMe mechanisms.
- The new method is fully integrated across:
      - method.h
      - method.c
      - gui.c
      - options.c
      - CLI help and GUI help panes

The helper functions are structured such that direct ATA taskfile commands or
direct NVMe admin commands (NVME_IOCTL_ADMIN_CMD, NVME_IOCTL_IO_CMD) can be
added later without modifying the high-level workflow of `nwipe_secure_erase()`.

This commit significantly expands nwipe’s capabilities by enabling hardware-
level sanitization, while preserving the existing method interface and GUI/CLI
behaviour.
@Knogle Knogle changed the title This commit introduces a new wipe method named "Secure Erase", integration Secure-Erase method option for supported ATA and NVMe devices Nov 26, 2025
@PartialVolume
Copy link
Collaborator

PartialVolume commented Nov 26, 2025

I'll take a look at this once the DIRECT I/O has been merged tomorrow. If it works ok, I'll probably merge it as is, with the view to maybe adding some additions to the GUI drive completion status. Hdparm provides an estimated wipe time, I always thought the estimated time provided by hdparm could be used in the GUI so instead of % completion it shows T-2:35:00 and counts down in real time from the estimated time provided by hdparm. If it reaches T-00:00:00 and hdparm still hasn't finished then it goes positive T+00:00:01

T minus to be used for ATA secure erase because we really don't know how long it will take and if we used percentage it would go over 100% and make it look broken. Overall ETA would also need looking at how it deals with an estimated time.

However, let me check this PR out as it is before you add anything further.

@Knogle
Copy link
Contributor Author

Knogle commented Nov 30, 2025

That's an interesting point, tbh didn't think about the estimated time issue!

@Knogle
Copy link
Contributor Author

Knogle commented Dec 24, 2025

Just ran an actual test. It worked great!

Screenshot From 2025-12-24 23-07-22 Screenshot From 2025-12-24 23-06-22 Screenshot From 2025-12-24 23-04-16
[2025/12/24 23:04:10]  notice:   verify   = 1 (last pass)
[2025/12/24 23:04:10]  notice: /dev/nvme0n1 has serial number 2535DV400054
[2025/12/24 23:04:10]  notice: /dev/nvme0n1, sect/blk/dev 512/4096/1000204886016
[2025/12/24 23:04:10]  notice: Attempting NVMe Secure Erase on /dev/nvme0n1 (NVME    ).
[2025/12/24 23:04:10]  notice: Starting NVMe Secure Erase via nvme format on /dev/nvme0n1.
[2025/12/24 23:04:25]  notice: NVMe Secure Erase completed successfully on /dev/nvme0n1.
[2025/12/24 23:04:25]  notice: Secure erase completed for /dev/nvme0n1, starting zero verification pass.
[2025/12/24 23:07:18] warning: nwipe_static_verify: The size of '/dev/nvme0n1' is not a multiple of its block size 32768.

******************************** Error Summary *********************************
!   Device | Pass Errors | Verifications Errors | Fdatasync I\O Errors
--------------------------------------------------------------------------------
   nvme0n1 |           0 |                    0 |                    0
********************************************************************************

********************************* Drive Status *********************************
!   Device | Status | Thru-put | HH:MM:SS | Model/Serial Number
--------------------------------------------------------------------------------
   nvme0n1 | Erased | 5318 MB/s | 00:03:08 | WD_BLACK SN7100 1/2535DV400054
--------------------------------------------------------------------------------
[2025/12/24 23:07:25] Total Throughput 5318 MB/s, Secure Erase (ATA/NVMe), 1R+B+VL
********************************************************************************

And one with a disk not supported.

[2025/12/24 23:03:47]  notice: /dev/sda has serial number 25436U800474
[2025/12/24 23:03:47]  notice: /dev/sda, sect/blk/dev 512/4096/4000787030016
[2025/12/24 23:03:47] warning: Secure Erase method is not supported on bus type  USB     (device /dev/sda).
[2025/12/24 23:03:47]   error: Secure Erase could not be executed on /dev/sda. Aborting method.
[2025/12/24 23:03:50]   fatal: Nwipe exited with errors on device = /dev/sda, see log for specific error


******************************** Error Summary *********************************
!   Device | Pass Errors | Verifications Errors | Fdatasync I\O Errors
--------------------------------------------------------------------------------
!      sda |           1 |                    0 |                    0
********************************************************************************

********************************* Drive Status *********************************
!   Device | Status | Thru-put | HH:MM:SS | Model/Serial Number
--------------------------------------------------------------------------------
!      sda |-FAILED-|    0 B/s | 00:00:00 | ASMT 2462 NVME/25436U800474
--------------------------------------------------------------------------------
[2025/12/24 23:03:50] Total Throughput    0 B/s, Secure Erase (ATA/NVMe), 1R+B+VL
********************************************************************************

@DaanSelen
Copy link

Wow! Never noticed this! Perhaps update the people here as well: #641

@DaanSelen

This comment was marked as off-topic.

@fthobe
Copy link
Contributor

fthobe commented Jan 7, 2026

@Knogle this looks amazing.

Some additional questions:

  • if you pool nvme-cli and ATA, can we go the extra mile and add sg_utils and sas / scsi sanitize
  • does this work in parallel (multiple disks same time) as remember on terminal you need to add parallel into the mix to achieve multiple disks
  • i wrote the guides in the shredOS repo, they should come in Handy walking down the different Protection Mechanisms on SAS (https://github.com/gms-electronics/formatingguide/blob/main/removeintegrityprotection.md)
  • What's the desired Output for the Report here?

Copy link
Contributor

@fthobe fthobe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some notes regarding output on failure and an additional comment regarding interuption during the process.

*/
if( rc != 0 )
{
nwipe_log( NWIPE_LOG_ERROR, "ATA Secure Erase: hdparm reported failure on %s (rc=%d).", c->device_name, rc );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be more verbose:
Replace "ATA Secure Erase: hdparm reported failure on %s (rc=%d)."
with "Error: hdparm reported failure on %s (rc=%d), run hdparm directly from terminal for a more detailed report."

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Knogle is there any verbose switch to catch the hdparm / nvme-cli and sg Output and Print it on screen / Output in Report

if( rc != 0 )
{
nwipe_log(
NWIPE_LOG_ERROR, "NVMe Secure Erase: nvme format reported failure on %s (rc=%d).", c->device_name, rc );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be more verbose:
Replace "NVMe Secure Erase: nvme format reported failure on %s (rc=%d)."
with "Error: NVME-CLI reported failure on %s (rc=%d), run nvme-cli directly from terminal for a more detailed report."

*
* This method does NOT write patterns itself. Instead it:
* 1) issues the appropriate secure-erase operation for the bus type
* 2) performs a full-device zero verification pass using nwipe_static_verify()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    1. Even if the drive is unplugged, the process will continue till completion or failure if the drive is reattached.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Crypto erase has no stop once initiated, from what I've read.

Copy link
Contributor

@fthobe fthobe Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Crypto erase has no stop once initiated, from what I've read.

That is indeed the expected behaviour. It varies though according to revisions of the implemented SATA standard (you can read more about revisions inside the mega long thread you linked)

@fthobe
Copy link
Contributor

fthobe commented Jan 7, 2026

Hey @Knogle , this is amazing work, I'd consider also adding sg_utils as thanks to your work it became low hanging fruit and considering that SAS still has a significant market share. sg_sanitize also allows to poll progress.
https://manpages.debian.org/testing/sg3-utils/sg_sanitize.8.en.html

An alternative would be to use openSeaChest, we had a longer discussion with @vonericsen if you remember. It would allow to have an abstraction layer for all three methods. @vonericsen can probably also tell you what possibilities there are to track progress.
https://github.com/Seagate/openSeaChest/wiki/Sanitizing-Storage-Devices

@fthobe
Copy link
Contributor

fthobe commented Jan 7, 2026

ATA / SATA / SAS (ATA pass-through) Using: hdparm --yes-i-know-what-i-am-doing --user-master u --security-erase NULL

sdparm and sg_utils are for SAS, hdparm for sata. I don't know if you are aware of it so I throw it in.

@fthobe
Copy link
Contributor

fthobe commented Jan 7, 2026

@PartialVolume What's the desired report output here?
@vonericsen reported a generally high confidence of this being a purge, but also he didn't really want to vouch for it. I think especially for chinese drives (which I saw more and more in the last years) this is an issue. The don't even report correct serial numbers, so I wouldn't be overly trustful with sanitize behaviour either.

@Knogle
Copy link
Contributor Author

Knogle commented Jan 7, 2026

@PartialVolume What's the desired report output here? @vonericsen reported a generally high confidence of this being a purge, but also he didn't really want to vouch for it. I think especially for chinese drives (which I saw more and more in the last years) this is an issue. The don't even report correct serial numbers, so I wouldn't be overly trustful with sanitize behaviour either.

At least we do a verify-zero pass afterwards, I think there is at least somewhat more confidence than just using the secure erase.

@fthobe
Copy link
Contributor

fthobe commented Jan 7, 2026

At least we do a verify-zero pass afterwards, I think there is at least somewhat more confidence than just using the secure erase.

I absolutely agree, but the intransparent behaviour of broken sectors remains a problem. I'd feel extremely hazy on this one and would really like to know what blanco does here as I believe it's clusterf**** and nobody really came up with a solution for this other than failing the report.

@PartialVolume
Copy link
Collaborator

At least we do a verify-zero pass afterwards, I think there is at least somewhat more confidence than just using the secure erase.

I absolutely agree, but the intransparent behaviour of broken sectors remains a problem. I'd feel extremely hazy on this one and would really like to know what blanco does here as I believe it's clusterf**** and nobody really came up with a solution for this other than failing the report.

With regards to the secure erase and optional verify zeros as being one selectable method, we will also have a method that consists of secure erase, followed by prng pass followed by verification on prng pass. In my mind this will attempt to mitigate against bad drive firmware not doing it's job properly hence why we use a prng pass. Why prng and not zeros or ones? Random data is pretty much impossible to compress, so the drive's firmware can't utilise any fancy algorithms to fool you into thinking you wiped it's memory when it's just marked the sector as wiped when it hasn't. Because the random data has to be reproduced exactly it's a lot harder for it to utilise any tricks to appear wiped when it didn't really wipe the memory.

Verification is another complication when using secure erase. It's fine when the secure erase resets the drive to all zeros but I've come across some SSD's that are perfectly functional but when you secure erase it you get a 0x3F occurring once in every sector, at the same location in that sector, where the rest of the sector is zeros. I don't know how common this is. But a zeros verification would fail, yet there is nothing actually wrong with the drive. A secure erase, prng pass plus last pass verification will correctly pass the drive. So depending on how common a secure wiped drive's firmware generates a non zero output it may be necessary for a additional smart verification to be written. One that recognises a repeating reproducible pattern.

In terms of over-provisioned memory in the drive, a secure erase, then prng pass + verification is the closest you will probably get to being sure all data is destroyed without taking out the chips and putting them in a reader to see what's left over.

There might also be the possibility the drive firmware could also be tampered with so again it appears to have wiped but didn't really, another reason why a prng pass is a must in my opinion. I'm thinking state level messing with firmware. Depending on the level of risk you can accept. The only 100% guarantee is to vaporise the drive which is a big shame. I hate to see perfectly functional hardware destroyed but your level of paranoia may well depend on the drive application. When 100% guarantees are required, as in military, security services, physical destruction is the only option but for everything else it's what level of risk is acceptable.

@fthobe
Copy link
Contributor

fthobe commented Jan 7, 2026

There might also be the possibility the drive firmware could also be tampered with so again it appears to have wiped but didn't really, another reason why a prng pass is a must in my opinion. I'm thinking state level messing with firmware. Depending on the level of risk you can accept. The only 100% guarantee is to vaporise the drive which is a big shame. I hate to see perfectly functional hardware destroyed but your level of paranoia may well depend on the drive application. When 100% guarantees are required, as in military, security services, physical destruction is the only option but for everything else it's what level of risk is acceptable.

I fully agree, but we should mention that in the report in the likes of:
"nwipe and ShredOS do not verify the integrity of the response returned by the disk controller and / or firmware. While the software consideres the Disk as wiped, compliance of individual drives might very according to their compliance to industry standards such as S-ATA, SAS or NVME. Clarify support with the drive manufacturer if needed."

Analogue to NIST 800-88r2, 3.1.1. Clear Sanitization Method, P.9

These still meet the NIST SP 800-88r2 Guidelines for Media Sanitization definition for the clear sanitization method as long as the device interface available to the user does not facilitate retrieval of the original data.

@Knogle
Copy link
Contributor Author

Knogle commented Jan 7, 2026

At least we do a verify-zero pass afterwards, I think there is at least somewhat more confidence than just using the secure erase.

I absolutely agree, but the intransparent behaviour of broken sectors remains a problem. I'd feel extremely hazy on this one and would really like to know what blanco does here as I believe it's clusterf**** and nobody really came up with a solution for this other than failing the report.

With regards to the secure erase and optional verify zeros as being one selectable method, we will also have a method that consists of secure erase, followed by prng pass followed by verification on prng pass. In my mind this will attempt to mitigate against bad drive firmware not doing it's job properly hence why we use a prng pass. Why prng and not zeros or ones? Random data is pretty much impossible to compress, so the drive's firmware can't utilise any fancy algorithms to fool you into thinking you wiped it's memory when it's just marked the sector as wiped when it hasn't. Because the random data has to be reproduced exactly it's a lot harder for it to utilise any tricks to appear wiped when it didn't really wipe the memory.

Verification is another complication when using secure erase. It's fine when the secure erase resets the drive to all zeros but I've come across some SSD's that are perfectly functional but when you secure erase it you get a 0x3F occurring once in every sector, at the same location in that sector, where the rest of the sector is zeros. I don't know how common this is. But a zeros verification would fail, yet there is nothing actually wrong with the drive. A secure erase, prng pass plus last pass verification will correctly pass the drive. So depending on how common a secure wiped drive's firmware generates a non zero output it may be necessary for a additional smart verification to be written. One that recognises a repeating reproducible pattern.

In terms of over-provisioned memory in the drive, a secure erase, then prng pass + verification is the closest you will probably get to being sure all data is destroyed without taking out the chips and putting them in a reader to see what's left over.

There might also be the possibility the drive firmware could also be tampered with so again it appears to have wiped but didn't really, another reason why a prng pass is a must in my opinion. I'm thinking state level messing with firmware. Depending on the level of risk you can accept. The only 100% guarantee is to vaporise the drive which is a big shame. I hate to see perfectly functional hardware destroyed but your level of paranoia may well depend on the drive application. When 100% guarantees are required, as in military, security services, physical destruction is the only option but for everything else it's what level of risk is acceptable.

So like two options? Like one with verify-zero, and another "enhanced" one with PRNG pass?

@fthobe
Copy link
Contributor

fthobe commented Jan 7, 2026

So like two options? Like one with verify-zero, and another "enhanced" one with PRNG pass?

For me that doesn't make a difference as the problem lies in Firmware response:
If the device responds correctly to sanitize any other action afterwards will not change the fact that the disk is wiped or "purged" according to NIST (so work is done), if the disk doesn't behave compliant overwriting might improve but not solve the issue (as remaining sectors with data might persist). I personally would always ho with random as a Write cycle is a Write cycle (no matter if random or not), but I do not know how much CPU time that claims on lower spec machines.

@fthobe
Copy link
Contributor

fthobe commented Jan 7, 2026

@PartialVolume @Knogle

This is how seagate currently categorizes sanitize. Everything that passes purge is currently defined as resonable Secure by NIST for non-overly sensitive data. It would not pass the thresholds for state secrets, but can be perfectly acceptable for regular business data.

For clarity:
Keep in mind that NIST as well as Seagate clarify that disk support might vary according to Firmware adherence to standard and integrity of the Firmware.

image

@PartialVolume
Copy link
Collaborator

So like two options? Like one with verify-zero, and another "enhanced" one with PRNG pass?

Yes, exactly.

@fthobe
Copy link
Contributor

fthobe commented Jan 8, 2026

@Knogle one last question: any reason you went with secure erase over sanitize?

@Knogle
Copy link
Contributor Author

Knogle commented Jan 8, 2026

@Knogle one last question: any reason you went with secure erase over sanitize?

I wasn't aware about those options! Maybe we can implement sanitze as well.

@fthobe
Copy link
Contributor

fthobe commented Jan 8, 2026

ahhh ok, I will give you a crash course:

secure erase does not fully delete all data on all drives as outlined here:
https://www.hddoracle.com/viewtopic.php?f=56&t=1412

Below an overview to verify sanitize support and execution with links to more detailed description outlining the different types like crypto scramble and all 0.

Secure erase is ancient and does not warrant the cancellation of data, but sometimes only drops tables.
Read More
I'd be extremely careful regarding reliability here. Sanitize would be the way to go.

Command Type hdparm (Docs) nvme-cli (Docs) sg_utils (Docs)
Verify Sanitize Support hdparm --sanitize-status /dev/sdx /dev/sdx: Issuing SANITIZE_STATUS command Sanitize status: State: SD0 Sanitize Idle Last Sanitize Operation Completed Without Error nvme id-ctrl -H /dev/nvme1 ... [2:2] : 0 Overwrite Sanitize Operation Not Supported [1:1] : 0x1 Block Erase Sanitize Operation Supported [0:0] : 0 Crypto Erase Sanitize Operation Not Supported ... % sg_opcodes /dev/sdc | grep -i sani 48 2 10 Sanitize 48 1f 10 Sanitize
Sanitize block erase hdparm --yes-i-know-what-i-am-doing --sanitize-block-erase /dev/sdx /dev/sdx: Issuing SANITIZE_BLOCK_ERASE command Operation started in background You may use --sanitize-status to check progress nvme sanitize -a 2 /dev/nvme1 The Unix convention is that "no news is good news" but that can be a bit unnerving after an operation like sanitize, especially if it finishes quickly (i.e. before the first progress poll is sent). Giving the --verbose option once should supply enough additional output to settle those nerves. sg_sanitize --block /dev/sdm The Unix convention is that "no news is good news" but that can be a bit unnerving after an operation like sanitize, especially if it finishes quickly (i.e. before the first progress poll is sent). Giving the --verbose option once should supply enough additional output to settle those nerves.

@fthobe
Copy link
Contributor

fthobe commented Jan 8, 2026

Ok, if we now even get a warning on ssd that people should check with vendor regarding compliance I'd be fully happy, @Knogle would have crushed it and new year was blessed 👯

@Knogle
Copy link
Contributor Author

Knogle commented Jan 8, 2026

Ok, if we now even get a warning on ssd that people should check with vendor regarding compliance I'd be fully happy, @Knogle would have crushed it and new year was blessed 👯

Sure we can do so! Have you got some kind of idea or suggestion where we should display such a warning?

@fthobe
Copy link
Contributor

fthobe commented Jan 8, 2026

@DaanSelen can you build and test this with SAS / NVME?

@fthobe
Copy link
Contributor

fthobe commented Jan 8, 2026

@DaanSelen do you people intend to sign the certificate?

@DaanSelen
Copy link

@DaanSelen do you people intend to sign the certificate?

Not really, may I ask why?

@PartialVolume
Copy link
Collaborator

That's the way it looks like at the moment. I'd like to implement sanitize block wipe as well. Basically i got it ready, will go through the next commit. I can do some testing with latest WD NVMe drives, as well as Crucial SATA and NVMe.

@Knogle secure erase/sanitise screenshots are looking good 🥇

@vonericsen
Copy link

@vonericsen man, thank you so much, you are beyond helpful and exhaustive. One Last question that bugs me: how reliable is all of this behind a usb Controller? As far as i understood plenty of them to neither allow all commands nor provide all data. Do erase / sanitize commands reliably work with them?

no problem!

For USB it can be a bit of a mess.

SATA USB:
Most modern adapters follow SAT and generally work fine, but occasionally need the commands formatted differently. Not just the USB adapters Seagate sells in the USB devices you can buy, but even many you can find shopping on the web. I have gone out and bought some just to test them and make our software work with them as best it can. Inside openSeaChest we have a giant table to change how we build CDBs for the adapters we know of. I had an internal spreadsheet going for a while to help track what works most often to fine tune our default behavior so as many things "just work" as possible. Sometimes there are still some things that don't play nice and need adjustment to get them working.

With older adapters you can run into various limitations. Some only support the 28bit command set and single sector transfers which means Sanitize won't work, but ATA security erase might. Generally, the main focus in the early adapters was ATA identify data and basic SMART data, so you don't always get much more than that.

If the adapters are old enough (or just using old enough firmware) that they only respond to vendor unique CDBs, then it depends on which vendor unique method it is for what works. Some are robust enough to support sending sanitize and others are not.
Some don't support any passthrough at all.

This linux kernel wiki (archived) mentions some issues specifically about ATA security erase. I have no idea how they got a bricked drive from this, but I have never seen this happen myself (we use all kinds of erase methods in our return sites for USB and haven't had this happen). I have no doubt it happened, but I would say it is not a common failure from my experience.

NVMe USB:
Every one of these available today uses a vendor unique passthrough method to issue commands.
I've implemented every one that I can so far.
Jmicron's is complete and should allow anything.
ASMedia has 2: Basic (only identify and get log page really) and a complete version that allows sanitize
Realtek has 2: Basic (Sanitize does not work and I partially got a format command through, but it's not documented so I don't know how to get the secure erase fields through) and a complete one that allows sanitize.

NVMe is basically in the early days of ATA over USB right now.
T10 is finally writing an official translation, but I think they are still focussed on HBAs over USB...but the USBs will likely implement this once it is done.

SAS USB:
These exist, but are very expensive and rare.
We bought one, but it's more or less limited to read/write and not much else.
When I attempted to read logs or do anything else it seemed to reject all the commands.

Other weird things on USB:
Some USB thumb drives implement SAT (Sandisk has some) and respond to some commands.
Some USB thumb drives will brick themselves if you send any of the vendor unique CDBs from the old passthrough days (pre-SAT) to them. Because of this openSeaChest does not attempt these legacy methods on anything not explicitly part of our internal lookup table that is known to work with them.
Some USB attached drives report very strange data over SAT which can make some software stop working properly. One I know of reports maxLBA of 0 and legacy CHS data as 0. You can read/write with SCSI commands fine, but not any passthrough ATA read/write commands. One of these does support sanitize using SAT, but others do not.
I have seen other weird things, but these are what I have run into most recently.

@PartialVolume
Copy link
Collaborator

PartialVolume commented Jan 8, 2026

@vonericsen Sorry, going slightly off topic here, but I've a quick question re openSeaChest versions. I'm just about to release the latest ShredOS with openSeaChest upgraded to 25.05.3, the build goes fine, but during final testing and audit of versions I notice that each program within openSeaChest has a different version. Is there some command that tells me I'm running 25.05.3 as the overall package version or if not is there somewhere that tells me what individual package versions are included in 25.05.3.

I'm probably being overly pedantic but I do like to check these things.

@vonericsen
Copy link

@vonericsen Sorry, going slightly off topic here, but I've a quick question re openSeaChest versions. I'm just about to release the latest ShredOS with openSeaChest upgraded to 25.05.3, the build goes fine, but during final testing and audit of versions I notice that each program within openSeaChest has a different version. Is there some command that tells me I'm running 25.05.3 as the overall package version or if not is there somewhere that tells me what individual package versions are included in 25.05.3.

I'm probably being overly pedantic but I do like to check these things.

No problem, this is a great question!

Currently openSeaChest's tools (openSeaChest_Basics, _Erase, etc) use semantic versions that come out of the --version option.
There isn't anything that specifically says "from v25.05.3".
There is a build-date in the banner of the tools which will match the date the release was made, so not necessarily May X, 2025, but October 9, 2025 in this case.

We do have one issue open around the build date though and will be implementing reproducible build dates in the future according to reproducible-builds.org

I have considered numerous times changing from semantic versions in each tool to matching the calendar versioning the full package uses instead.

If you have any suggestions or thoughts on this, please let me know. I know this is something we need to address to resolve confusion as you are not the first person to ask me this.

P.S. I think later this month a new openSeaChest release will come out with the big feature being JSON formatted output. We have a little more work to do, but it is close.

@PartialVolume
Copy link
Collaborator

There isn't anything that specifically says "from v25.05.3".
There is a build-date in the banner of the tools which will match the date the release was made, so not necessarily May X, 2025, but October 9, 2025 in this case.

Thanks for the quick response, in my case the build date shows my build date as 8 Jan as I'm building from source [SourceCode_With_Submodules.tar.xz](https://github.com/Seagate/openSeaChest/releases/download/v25.05.3/SourceCode_With_Submodules.tar.xz)

snap

Not to worry, I just thought there might be some txt file which listed the versions included in v25.05.03

Add two new device-internal sanitize methods in addition to existing
Sanitize Crypto Erase:

- Sanitize Block Erase (ATA/SCSI/NVMe)
- Sanitize Overwrite (ATA/SCSI/NVMe)

Both methods trigger the drive's internal SANITIZE feature where
supported and do not perform read-back verification, as post-sanitize
read patterns are device-specific and may not be deterministic.

The implementation selects the appropriate backend automatically based
on the detected bus type (ATA, SCSI, NVMe).

These methods are intended for secure, standards-aligned media
sanitization using device-native mechanisms.
@DaanSelen
Copy link

Okay just compiled the program and was checking out the new features. Couple things I wanted to ask:

  • Secure Erase has a PRNG and verify mode.
    Is this unneeded for the crypto erase? I would love certainties in this regard.

Is there a way to verify if all these methods passed correctly since its all dependent on compliant firmware?

Just some "reassurances"

@fthobe
Copy link
Contributor

fthobe commented Jan 9, 2026

Secure Erase has a PRNG and verify mode.
Is this unneeded for the crypto erase? I would love certainties in this regard.

The concept of cancellation is different here:

  • the data is encrypted at device level
  • no encryption key no data

If you cancel the key the data is inaccessible, this right now is considered "Purge" according to nist. Keep in mind though that today's definition of secure might change (e.g. if tomorrow a new quantum computer solves any calculation of any prime number, any definition of security by eliminating keys goes out of the window). Also consider that people tend to overestimate wear on drives. If you run one full cycle for a rewrite, it's still just one cycle.

== UPDATE ==
Read this: https://github.com/Seagate/openSeaChest/wiki/Sanitize-Feature

@DaanSelen
Copy link

== UPDATE == Read this: https://github.com/Seagate/openSeaChest/wiki/Sanitize-Feature

Thanks I was familiar with the crypto erase. But if possible I want to check if the data is actually unreadable with a crypto erase.
And with our methods, it should. But what if the firmware failed? What if the firmware returns a wrong exit code because its a off-brand SSD?
Can we account for that?

P.S. The Secure Erase + PRNG + Verify has crashed on my laptop (it was 3000KB/S syncing anyway).

I am going to try again.

Do we want the files/reports/dmesg/logs of my runs?

@fthobe
Copy link
Contributor

fthobe commented Jan 9, 2026

Always post them when you have failures

@fthobe
Copy link
Contributor

fthobe commented Jan 9, 2026

Can you poll Support for sanitize commands? I think that's a sata > m.2 and not real nvme, secure erase should work on this one and sanitize block should work.

@Knogle errors are not handled correctly as the PDF Shows erased in the Header.

@DaanSelen
Copy link

Can you poll Support for sanitize commands? I think that's a sata > m.2 and not real nvme, secure erase should work on this one and sanitize block should work.

@Knogle errors are not handled correctly as the PDF Shows erased in the Header.

I don't have a SSD ready at home (maybe with some luck) but I will return to this on monday! Unless I can do this on HDD's.

@Knogle
Copy link
Contributor Author

Knogle commented Jan 9, 2026

Currently testing on my WD SN7100. sanicap : 0x60000002 So unfortunately only Sanitze Block Erase is supported.

@fthobe
Copy link
Contributor

fthobe commented Jan 9, 2026

Currently testing on my WD SN7100. sanicap : 0x60000002 So unfortunately only Sanitze Block Erase is supported.

That because if the drive doesn't encrypt by it's own the strategy can't work, but there's still Block erase and overwrite which should Both do the Job.

@DaanSelen
Copy link

DaanSelen commented Jan 9, 2026

Currently testing on my WD SN7100. sanicap : 0x60000002 So unfortunately only Sanitze Block Erase is supported.

That because if the drive doesn't encrypt by it's own the strategy can't work, but there's still Block erase and overwrite which should Both do the Job.

Would it be possible to either disable unsupported methods or at least let the person know if something has not succeeded?

@fthobe
Copy link
Contributor

fthobe commented Jan 9, 2026

Currently testing on my WD SN7100. sanicap : 0x60000002 So unfortunately only Sanitze Block Erase is supported.

That because if the drive doesn't encrypt by it's own the strategy can't work, but there's still Block erase and overwrite which should Both do the Job.

Would it be possible to either disable unsupported methods or at least let the person know if something has not succeeded?

Yes, but:

  • parsing the result of a feature poll is complicated
  • not All devices respond correctly

One way would be to trigger and Abort an unrestricted sanitize (sanitize can not be aborted and resumes even After a disconnect from power when ran as restricted).

@DaanSelen
Copy link

With the release of v0.40 I am curious to the feedback given and the process further :)

I DO NOT INTENT THIS TO PUT PRESSURE JUST CURIOUS

@PartialVolume
Copy link
Collaborator

With the release of v0.40 I am curious to the feedback given and the process further :)

I DO NOT INTENT THIS TO PUT PRESSURE JUST CURIOUS

My focus over the next 24hrs will be the release of ShredOS, built with the latest 0.40 nwipe. Everything is complete and tested. Probably the largest release notes for ShredOS I have ever written has been completed. Uploading eight .isos and .IMG files with checksums is where I'm at, and it's truly tediously slow at uploading these images to GitHub. I'm not sure if it's my fibre connection (unlikely) or whether it's GitHub throttling the uploads. Anyway fingers crossed by tomorrow I'll release ShredOS.

As for nwipe, going forward, I'll be looking at @Knogle 's SSD PR.

@fthobe
Copy link
Contributor

fthobe commented Feb 4, 2026

@PartialVolume man, I so much appreciate what to do but I believe getting some funding from the OSS community and public grants through incorporating as an association would be a step forward to distribute workloads better. You know I come from refurbishment sales, I know like ten companies that for removing blanco would help funding this

@DaanSelen
Copy link

@PartialVolume man, I so much appreciate what to do but I believe getting some funding from the OSS community and public grants through incorporating as an association would be a step forward to distribute workloads better. You know I come from refurbishment sales, I know like ten companies that for removing blanco would help funding this

Maybe a organisation/non-profit for some priority support?

@HannibalHamiltonJones
Copy link

Hi, I’m joining the discussion a bit late, but I wanted to suggest an enhancement to how the new firmware‑based secure erase feature could be integrated.
Instead of offering firmware sanitize only as a standalone overwrite method, it would be very useful to also support it as an optional preliminary step that can run before another overwrite method. For example, the Finnish NCSA guidelines for SSD/NVMe sanitization recommend using the device’s firmware sanitize function followed by two passes of pseudorandom data. This type of workflow would be possible only by running nwipe multiple times with different configurations, which leads to duplicated reports and log files and gets messy quickly.
What I’m imagining is something like:

--firmware-erase=yes|no|force

Where:

yes: run the appropriate firmware erase/sanitize operation for the disk, then continue with the chosen overwrite method even if the firmware step encounters an error. Any failure should raise a warning in the logs and appear in the PDF report.

force: run the firmware erase, but do not continue to any overwrite method if the firmware sanitize step fails.

This would allow users to combine firmware‑level sanitization with traditional overwrite methods. Providing one report and one run compliancy with NCSA-FI guidelines

@PartialVolume
Copy link
Collaborator

PartialVolume commented Feb 20, 2026

For example, the Finnish NCSA guidelines for SSD/NVMe sanitization recommend using the device’s firmware sanitize function followed by two passes of pseudorandom data.

I do plan on having SSD/NVMe as not only standalone but incorporated into methods. So for instance we could have a method called Finnish NCSA which would comprise of,

  • pass 1 SSD/NVMe sanitise
  • pass 2 PRNG data
  • pass 3 PRNG data

Optionally you could select last pass or ALL verification although I'm not sure about the verification on the sanitise operation if you selected ALL, as there are some edge case drives that produce non zero output. So initially we might ignore verification on the SSD and just verify the two PRNGs, assuming you selected Verification=ALL.

So yes, it would produce just the one report.

@Knogle
Copy link
Contributor Author

Knogle commented Mar 6, 2026

Tbh i am not really satisfied with this one yet, i think it's far too large already to properly troubleshoot it, apart from simple secure erase, nothing works reliably accross SSDs (or maybe it's the expected behaviour due to firmware blabla?) In my opinion we have to re-evaluate this thing here, and maybe just go for a few simple options, and leave this sanitize stuff for specialized tools. What do you think guys? @PartialVolume @fthobe @desertwitch

@fthobe
Copy link
Contributor

fthobe commented Mar 6, 2026

Where do you struggle?

@PartialVolume
Copy link
Collaborator

PartialVolume commented Mar 7, 2026

To integrate SSD/NVMe sanitisation into nwipe I always thought would take a huge number of changes to methods, contexts and the GUI. I can see how it's going to work in my head but I've not documented the changes that need to take place yet.

The drive selection screen will change so frozen drives are immediately visible requiring nwipe to send the system to sleep for a few seconds if a specific drive is selected for secure erase., I posted a mockup of the new drive selection some time ago.

It maybe that where we select wipe using the spacebar this field toggles through WIPE then SERA, SERA being secure erase rather than a traditional wipe. This is obviously necessary as the system may have one SSD and a traditional hard drive so you may want to wipe different drives with different methods at the same time.

There will be a new selection screen/tab for selecting SSD/NvMe options relevant to SERA selected drives.

Nwipe currently applies only one method to all drives, this will have to change so that two or even three different methods can be run concurrently.

I'd prefer we wrote low level code, at least for ATA secure erase but I guess it depends how many manufacturers deviate from the standard.

The problem for me with this PR is the secure erase is not selectable individually for each drive. Toggling WIPE/SERA with the spacebar would solve that but requires a fundamental change in that two different methods need to run at the same time.

Also lots of work would need doing to the progress percentage as there is no progress data from the drive so we have to estimate completion.

I think it's doable or are you talking about issue closer to the drives, i.e just not behaving correctly with hdparm?

Originally my plan was not to use hdparm but write our own low level code as I did for accessing HPA/DCO without using hdparm.

@Knogle
Copy link
Contributor Author

Knogle commented Mar 7, 2026

That's what i would like to go for as well! Having our own code in place for those erase options, at least for those widely accepted ones. I'd consider this PR more a PoC than a real implementation tbh at this point, because as you pointed out, major changes have to be made to how nwipe works.

@desertwitch
Copy link
Contributor

desertwitch commented Mar 7, 2026

I'd generally tend to favour low level code as well, as opposed to depending on (vendor) tool X or Y. I'm not an expert on the topic (nor have a real need for such a feature myself), but if a standard exists then I think we should support that one first and foremost. If a vendor chooses not to implement that standard then that's on them and people will need to use their tools instead (which we can ship inside ShredOS, rather than making them a dependency of nwipe).

I also see this requiring a larger rewrite of many parts of the program, but I have no specific vision about it in my mind and I think it's something that we should carefully test/plan so we don't cause degraded quality of the previous core "selling points" of nwipe (which I believe are mostly wiping spinning rust reliably and portably).

We should also consider if nwipe generally needs such a feature, and again I'm neutral on this. As in: Will it provide any benefit over the existing solutions, because arguably it does fill a specific need/gap in open source erasing solutions for HDDs, but then there are several (apparently not so bad?) solutions for NVMe (OpenSeaChest, ...).

Is it more a nice to have or something where we're meaning to fill a substantial need? Are we able to provide a better experience than what is already available? In my mind a program that does a few things very well seems generally favourable to a jack of all trades which does some things well and others poorly. The latter especially being a risk if there's no consensus on a standard (among vendors) and we're basically playing catch-up all the time.

If realistically out of 10 NVMe wipes, 6 fail because of vendor-specific quirks... not sure if it's worth it (now) over being revisited at a point when the industry has decided on a common standard (if that ever happens).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants