How to Secure Erase an NVMe SSD, Step by Step
The nvme-cli commands in order: check what the drive supports, run Sanitize or Format, watch it finish, check the result, and keep a record for each drive.

To secure erase an NVMe SSD, use the erase commands built into the drive, not a format from your operating system and not an overwrite tool. On Linux the tool is nvme-cli. The order is short: ask the drive what it supports, run Sanitize if it has it, otherwise Format with a secure erase setting, wait for it to finish, check the result, and write it down.
For the reasons behind the choice of command, see NVMe Format vs Sanitize. For SATA and self-encrypting SSDs as well, see how to wipe an SSD securely.
- Boot from a USB stick, never from the drive you're erasing. Find the drive with
nvme listand match its serial number. - Read three fields with
nvme id-ctrl: OACS (is Format supported), FNA (can Format do a crypto erase) and SANICAP (which Sanitize actions exist). - Before erasing, write a few markers you can look for afterwards.
- Run Sanitize Block Erase or Crypto Erase if the drive has them. Otherwise Format with
--ses=2, then--ses=1. If none works, an overwrite is Clear, not Purge. - A Sanitize runs in the background. Read
nvme sanitize-loguntil it says the sanitize completed. - Check the result, then record the serial, command, setting, outcome and check for each drive.
Before you start
Every command marked DESTRUCTIVE erases data with no undo. Copy off anything you need first.
Boot any live Linux USB stick (a desktop installer image works) and install the tool: sudo apt install nvme-cli on Debian or Ubuntu, sudo dnf install nvme-cli on Fedora. You can't erase the drive the running system lives on.
Commands here use nvme-cli 2.x names, which still work in 3.x with a warning (3.x renamed id-ctrl to id ctrl and sanitize-log to log sanitize). Options marked 3.0+ don't exist in 2.x. The messages we quote are from nvme-cli 2.13.
A controller is the drive's own processor; Linux names it /dev/nvme0. A namespace is the storage the controller shows to the computer as a disk, named /dev/nvme0n1. Most laptop drives have one namespace.
Step 1. Find the drive and check what it supports
List the NVMe drives:
sudo nvme list
Write down the serial number from the SN column. It's how you prove later which drive you erased.
Don't trust the device number alone. The nvme-cli manual warns: "Do not assume any particular device relationship based on their names. If you do, you may irrevocably erase data on an unintended device." So confirm the controller you're about to use has the serial you wrote down:
sudo nvme id-ctrl /dev/nvme0 | grep -E '^(sn|mn) '
Then read the three fields that decide which erase you can run:
sudo nvme id-ctrl /dev/nvme0 | grep -E '^(oacs|fna|sanicap) '
Add -v to have nvme-cli spell out every bit. Bit names are from the NVMe Base Specification (Revision 2.4, Figure 338):
| Field | Bit (hex value) | Name in the spec | If it's set |
|---|---|---|---|
| OACS | bit 1 (0x2) | Format NVM Supported | The drive accepts nvme format |
| FNA | bit 2 (0x4) | Cryptographic Erase Supported | Format can do a crypto erase (--ses=2) |
| FNA | bit 1 (0x2) | Secure Erase Namespace Scope | A secure erase by Format covers every namespace, not only the one you name |
| SANICAP | bit 0 (0x1) | Crypto Erase Support | Sanitize Crypto Erase is available |
| SANICAP | bit 1 (0x2) | Block Erase Support | Sanitize Block Erase is available |
| SANICAP | bit 2 (0x4) | Overwrite Support | Sanitize Overwrite is available. It's slow and wears flash, so on an SSD use the next line in Step 2 |
| SANICAP | bit 5 (0x20) | Sanitize Purge Request and Reporting Supported | The drive can be told to fail unless it purges, and reports whether it did |
For example, sanicap : 0x3 means bits 0 and 1 are set, so the drive has Sanitize Crypto Erase and Block Erase. The spec says SANICAP "shall be cleared to 0h" if the drive doesn't support Sanitize at all.
Last, check that nothing on the drive is mounted:
lsblk -o NAME,SIZE,MOUNTPOINT /dev/nvme0n1
The MOUNTPOINT column must be empty on every line. Some live images mount internal partitions on their own. If any line shows a mount point, unmount it (sudo umount /dev/nvme0n1p1, and so on) before Step 3.
Step 2. Pick the command
Go down this list and stop at the first one the drive supports.
| Order | Command | What it erases | NIST SP 800-88 |
|---|---|---|---|
| 1 | Sanitize, Block Erase | The whole drive: user data, deallocated blocks, caches, spare areas | Purge under IEEE 2883, which Rev. 2 points to, when the drive purges. Only --preq (3.0+) on a drive with SANICAP bit 5 makes it fail rather than only clear, and its Purged bit says which it did |
| 2 | Sanitize, Crypto Erase | The whole drive, by changing every encryption key | Purge, if the drive's encryption meets NIST's preconditions |
| 3 | Format, --ses=2 (Cryptographic Erase) | The namespace, or every namespace if FNA bit 1 is set, by deleting the key | Purge in NIST Rev. 1 (2014). Rev. 2 doesn't list NVMe commands |
| 4 | Format, --ses=1 (User Data Erase) | All user data in the namespace (or all namespaces), including caches and deallocated blocks | Purge in NIST Rev. 1. Rev. 2 doesn't list NVMe commands |
| 5 | Overwrite through normal writes | Only the blocks the computer can address | Clear |
| Never | Format with no --ses (SES=0) | Nothing is erased | Neither. Don't record it as a wipe |
In NIST's terms, Purge makes recovery "infeasible using state-of-the-art laboratory techniques"; Clear only stops recovery through the drive's normal interface. Sanitize comes first because it covers the whole drive, can't be aborted and survives a power cut. Block Erase comes before Crypto Erase because you can read it back. Format with a secure erase setting is the fallback. NVMe Format vs Sanitize explains which counts as Purge and why.
We put --ses=2 before --ses=1 because on a drive that encrypts everything, the spec lets a User Data Erase be done as a crypto erase anyway. Asking for one by name at least tells you what you got.
Step 3. Write check markers (before you erase)
A success message is the drive's claim. Markers test it. Write a short marker at a few places, and read each back so you know the check works:
# DESTRUCTIVE: overwrites 4 KB at this spot. Only on a drive you're about to erase.
printf 'ERASE-CHECK-01' | sudo dd of=/dev/nvme0n1 bs=4096 seek=1000 conv=fsync
sudo dd if=/dev/nvme0n1 bs=4096 skip=1000 count=1 iflag=direct | grep -a -c ERASE-CHECK
The second command should print 1. Repeat near the middle and the end of the drive by changing seek and skip together. Each write is DESTRUCTIVE too, so only on a drive you're about to erase. iflag=direct reads the drive itself, not a copy Linux kept in memory.
Step 4. Run the erase and watch it finish
Pick the one command from Step 2. Each is DESTRUCTIVE.
# 1. Sanitize, Block Erase. DESTRUCTIVE: erases the whole drive.
sudo nvme sanitize /dev/nvme0 --sanact=0x02
# 2. Sanitize, Crypto Erase. DESTRUCTIVE: erases the whole drive.
sudo nvme sanitize /dev/nvme0 --sanact=0x04
# 3. Format with Cryptographic Erase. DESTRUCTIVE.
sudo nvme format /dev/nvme0n1 --ses=2
# 4. Format with User Data Erase. DESTRUCTIVE.
sudo nvme format /dev/nvme0n1 --ses=1
# 5. Only if the drive refused 1 to 4: overwrite (Clear, not Purge). DESTRUCTIVE.
sudo dd if=/dev/urandom of=/dev/nvme0n1 bs=1M oflag=direct status=progress
The overwrite ends with No space left on device; that's normal. Record it as Clear.
Sanitize goes to the controller (/dev/nvme0). Format goes to the namespace (/dev/nvme0n1).
Format waits until it's done. nvme-cli 2.x stops waiting after 10 minutes, so on a large drive with --ses=1 add --timeout=3600000 (an hour, in milliseconds). It first warns "Format may irrevocably delete this device's data" and gives you 10 seconds to press Ctrl-C; leave --force off to keep that. Success prints Success formatting namespace:1. Any other message is a failure.
Sanitize doesn't wait. The command comes back almost at once, because sanitize operations "are performed in the background", in the spec's words. So read the drive's Sanitize Status log:
sudo nvme sanitize-log /dev/nvme0 -v
With -v, nvme-cli spells out the Sanitize Operation Status in these words:
| What nvme-cli prints | What it means |
|---|---|
Sanitize in Progress. | Still running. Sanitize Progress (SPROG) is a count out of 65,536 |
Most Recent Sanitize Command Completed Successfully. | Finished. This is what "done" looks like |
Most Recent Sanitize Command (No-Deallocate After Sanitize) Completed Successfully. | Also finished. You only see it if you asked the drive not to deallocate afterwards |
Most Recent Sanitize Command Failed. | The erase failed. See Step 6 |
NVM Subsystem has never been sanitized. | Your command didn't start a sanitize at all |
Don't check every second. The spec says hosts "should limit this polling (e.g., to at most once every several minutes) to avoid interfering with the progress of the sanitize operation itself." The log also lists the drive's own time estimates. If the power goes, the sanitize carries on: it "is not able to be aborted and continues after a Controller Level Reset, including across power cycles."
On nvme-cli 3.0+ you can add --wait to have the sanitize command wait for the end, and --preq (Purge Required) if SANICAP bit 5 is set. With --preq, the log then has a Purged bit: set means the drive purged as defined by IEEE 2883; clear means it only cleared.
Step 5. Check that it worked
Markers, for every method. Run the marker read commands from Step 3 again. Each should now print 0. If dd reports an I/O error instead, the block wasn't read and that 0 proves nothing. For a crypto erase, this is the check: the drive can return anything once the key is gone, so reading it back proves nothing.
Read back, for Block Erase and Format --ses=1. Read the whole drive and see whether it's one repeated value:
sudo blockdev --flushbufs /dev/nvme0n1
sudo dd if=/dev/nvme0n1 bs=1M iflag=direct status=progress | hexdump -C | head
hexdump replaces repeated lines with a *, so a fully erased drive prints three lines: 16 bytes of 00 (or ff on some drives), a *, and the drive's size. Any other bytes mean data the erase didn't reach. It reads every addressable block, so it takes a while.
If dd stops with I/O errors after a Block Erase or Crypto Erase, that can be the drive's own integrity check, which the spec allows (Annex A.3); then neither the read-back nor the markers can be checked; rely on the sanitize log (and the Purged bit, if you used --preq), and note the read errors on the record.
A User Data Erase that reads back as random bytes may have been done as a crypto erase, which the spec allows. Then the markers decide.
The spec itself says "only the accessible storage is able to be audited." For the spare flash a drive keeps for wear, you're trusting the drive, one more reason to prefer Sanitize.
Step 6. When it doesn't work
The drive is in use. Unmount its partitions (see the end of Step 1), or reboot from the USB stick if you booted from it.
"Invalid Field in Command". The drive doesn't support what you asked for. The spec says a sanitize with an unsupported action is aborted "with a status code of Invalid Field in Command." Go back to Step 2 and take the next line.
The sanitize failed. The drive then refuses most commands until the failure is cleared. Run the same sanitize again. The commands above run in restricted mode (no --ause), and in that mode the drive refuses Exit Failure Mode (--sanact=0x01): only another sanitize clears the failure. Exit Failure Mode works only after a sanitize started with --ause, and it erases nothing, so a drive recovered that way isn't sanitized. If a second try fails too, treat the drive as one to destroy.
The drive is in a USB enclosure. Many enclosures don't pass these commands through. Connect the drive directly.
nvme list shows nothing, and the drive is M.2. Some M.2 drives are SATA, not NVMe. lsblk -d -o NAME,TRAN,MODEL shows sata for them. Use the SATA steps in how to wipe an SSD securely.
nvme list shows nothing, but the BIOS shows an NVMe drive. Many laptops with Intel 8th to 10th generation processors ship with the BIOS storage mode set to RAID (Intel Rapid Storage Technology, often for Optane), which hides NVMe drives from Linux. Check:
sudo dmesg | grep -i 'remapped nvme'
A line ending in Found 1 remapped NVMe devices. comes with the kernel's advice: Switch your BIOS from RAID to AHCI mode to use them. Do that, then boot the USB stick again. If the laptop has no such setting, take the drive out, erase it in another computer, and note which laptop it came from. Erase any Optane cache module too: it holds copies of the user's files.
Step 7. Write it down
For each drive, record:
- Model and serial number.
- The exact command and setting, such as "Sanitize, Block Erase" or "Format NVM, SES=1". Not "secure erase".
- The scope: whole drive, one namespace, or all (FNA bit 1).
- Clear or Purge, and on what basis: the Purged bit, or the standard you follow.
- The check and its result.
- Who, when, and the tool version (
nvme version).
NIST SP 800-88 Rev. 2 lists these for a certificate of sanitization. Our free certificate of sanitization template has all of them.
On Windows
We know of no command that ships with Windows and sends NVMe Sanitize or a secure-erase Format. Windows has:
- Diskpart
clean all. Microsoft's documentation says it "Specifies that each and every sector on the disk is set to zero." That's an overwrite through normal writes: Clear at best, and it doesn't reach the spare blocks inside an SSD. - A programming interface for developers,
IOCTL_STORAGE_REINITIALIZE_MEDIA, which Microsoft says comes with "no guarantee as to the successful deletion or recoverability of the data". - Erase options in some laptop BIOS setups and drive makers' tools. NIST warns that "the command name might imply a certain capability but not actually meet minimum requirements for the sanitization method." Find out which command they send.
On a Windows machine, the simplest route is to boot a Linux USB stick and follow the steps above.
Where reCore fits
A reCore station booted from reCore OS runs the same steps by itself for each NVMe drive, with one difference in order: quickest first. That's Format with Cryptographic Erase, then User Data Erase, then Sanitize Crypto Erase, then Block Erase. It keeps the drive's OACS, FNA and SANICAP values with the record, and reads the Sanitize Status log until it reports the result, for up to 15 minutes. A failed sanitize, or one still running after that, fails the wipe.
These commands run only on reCore OS, which boots from a USB stick or, set up on request, by PXE network boot. A station running inside Windows overwrites NVMe drives, and the certificate says Clear. Each drive gets its own signed certificate, checkable at recore.replugit.com/verify. reCore doesn't set Purge Required yet. The next release can switch a RAID-mode BIOS to AHCI when a workflow allows it and the firmware lets the station change it (not with a BIOS administrator password); that hasn't run on real hardware yet. More on the data wipe page.
To see it on one of your own drives, email [email protected].
Sources
- NVM Express, NVM Express Base Specification, Revision 2.4, ratified July 31, 2026. Section 5.2.11 (Figure 195, Secure Erase Settings), Figure 312 (Sanitize Status log page), Figure 338 (OACS, FNA and SANICAP fields), section 8.1.27 (sanitize operations, the Restricted Failure state in 8.1.27.4.3) and Annex A (A.2 and A.3).
- linux-nvme, nvme-cli manual pages: nvme-sanitize, nvme-format, nvme-id-ctrl, nvme-sanitize-log and nvme-list (version 2.13), plus the 3.2 pages for nvme-sanitize and nvme-log-sanitize. Printed messages from the nvme-cli 2.13 source.
- NIST, SP 800-88 Rev. 2, Guidelines for Media Sanitization, September 2025. Sections 3.1.1, 3.1.2, 3.2 and 4.6, and Appendix B.
- NIST, SP 800-88 Rev. 1, December 2014 (replaced by Rev. 2). Table A-8, NVM Express SSDs.
- Linux kernel, drivers/ata/ahci.c (the remapped NVMe messages).
- util-linux, hexdump manual: without
-v, repeated lines "are replaced with a line comprised of a single asterisk." - Microsoft, diskpart clean and IOCTL_STORAGE_REINITIALIZE_MEDIA.
Frequently asked questions
How do I securely erase an NVMe SSD?
Boot the computer from a USB stick with nvme-cli on it, not from the drive. Run nvme id-ctrl to see what the drive supports. If it supports Sanitize, run nvme sanitize with Block Erase or Crypto Erase and read the sanitize log until it reports success. If not, run nvme format with --ses=2 (Cryptographic Erase) or --ses=1 (User Data Erase). Then check the result and write down the drive's serial number, the command, the setting and the outcome.
Can I secure erase an NVMe SSD from Windows?
Not with a command that ships with Windows, as far as we know. Diskpart's clean all sets every sector to zero through normal writes, which is Clear under NIST, not Purge, and it can't reach the drive's spare blocks. Windows has a programming interface that hands the erase to the drive, but it isn't a command you can type. The practical route is to boot from a Linux USB stick with nvme-cli, or use a tool that does, and follow the same steps.
Is nvme format the same as a secure erase?
Only with a secure erase setting. nvme format with --ses=1 asks the drive for a User Data Erase and --ses=2 for a Cryptographic Erase. With no --ses option, the setting is 0, which nvme-cli's manual describes as No secure erase operation requested. Don't record that as a wipe.
How long does an NVMe sanitize take?
It depends on the drive and the action, and the drive tells you. nvme sanitize-log prints the drive's estimated time in seconds for each action (Overwrite, Block Erase, Crypto Erase), or says no time period is reported. The sanitize command itself returns at once while the erase runs inside the drive, so read the sanitize log until it says the sanitize completed.
Why does nvme list not show my NVMe drive?
On many laptops with Intel 8th to 10th generation processors, the BIOS storage mode is set to RAID (Intel Rapid Storage Technology), which hides NVMe drives from Linux. The kernel log then says Found 1 remapped NVMe devices and Switch your BIOS from RAID to AHCI mode to use them. Switch the storage mode to AHCI in the BIOS, or take the drive out and erase it in another computer.
reCore Research Lab
OfficialCompliance & Security Group
Technical research group specializing in NIST SP 800-88, IEEE 2883, SERI R2v3 standards, and forensic data recovery testing.
Wipe every drive. Prove every wipe.
reCore picks the purge method for each drive, verifies the result, and issues a per-drive certificate that a second person approves.
Related Guides & Research
Continue exploring compliance standards, firmware sanitization, and hardware diagnostics.

Does Degaussing Destroy a Hard Drive? What NIST SP 800-88 Rev. 2 Says
Under NIST SP 800-88 Rev. 2, degaussing is a Purge for magnetic drives only. Why it does nothing to SSDs, when a degausser is too weak, and what to record.

How to Choose Remote Wipe Software: 8 Questions to Ask
How to choose remote wipe software for an ITAD floor or IT team: the two kinds, what each proves, and eight questions to ask any vendor.

How to Wipe a Laptop When an Employee Leaves, With Proof
Reset it for the next hire, or erase every drive with a certificate if it leaves the company. What an MDM wipe proves, and an offboarding checklist.
Stay Ahead in Data Sanitization & ITAD Compliance
Join enterprise IT managers and electronics refurbishers receiving our monthly technical standards breakdowns, NIST/R2v3 audit tips, and benchmark releases.