NVME-SANITIZE(1)

🌸 nvme-sanitize β€” the manual page (nvme-sanitize(1)) πŸ’…

okay bestie, welcome to nvme-sanitize(1) from the NVMe Manual ✨ this is the page where you learn how to make a drive absolutely forget everything it ever knew. iconic behavior, tbh.


✨ NAME ✨

nvme-sanitize β€” send the NVMe Sanitize Command, and it hands you back the result 🫢


✨ SYNOPSIS ✨

nvme [<global-options>] sanitize <device> [--no-dealloc | -d] [--oipbp | -i]
                        [--owpass=<overwrite-pass-count> | -n
                        <overwrite-pass-count>]
                        [--ause | -u] [--sanact=<action> | -a <action>]
                        [--ovrpat=<overwrite-pattern> | -p <overwrite-pattern>]
                        [--emvs | -e] [--preq | -q] [--force] [--wait | -w]
                        [--repeat=<repeat-count> | -r <repeat-count>]

✨ DESCRIPTION ✨

So for the NVMe device you point at, this thing sends a Sanitize command and then tells you how it went. literally that's the whole job πŸ’–

The <device> parameter is mandatory β€” it's an NVMe character device, like /dev/nvme0, okay? no skipping this.

On success it returns 0. any other time, it returns an error code. no cap.


✨ OPTIONS ✨

  • -d, --no-dealloc β€” No Deallocate After Sanitize. if this is set, the controller shall not deallocate any logical blocks as a result of successfully completing the sanitize operation. if it's cleared, the controller should deallocate logical blocks as a result of successfully completing the sanitize operation. 🫢 this bit shall be ignored if the Sanitize Action field is set to 001b (i.e., Exit Failure Mode).
  • -i, --oipbp β€” Overwrite Invert Pattern Between Passes. if set, the Overwrite Pattern shall be inverted between passes. if cleared, the overwrite pattern shall not be inverted between passes. this bit shall be ignored unless the Sanitize Action field is set to 011b (i.e., Overwrite). πŸ™ˆ
  • -n <overwrite-pass-count>, --owpass=<overwrite-pass-count> β€” Overwrite Pass Count. this field says how many overwrite passes you want (i.e., how many times the media is to be overwritten) using the data from the Overwrite Pattern field of this command. a value of 0 means 16 overwrite passes β€” yes, zero means sixteen, we don't make the rules πŸ’€ this field shall be ignored unless the Sanitize Action field is set to 011b (i.e., Overwrite).
  • -u, --ause β€” Allow Unrestricted Sanitize Exit. if set, the sanitize operation is performed in unrestricted completion mode. if cleared, it's performed in restricted completion mode. this bit shall be ignored if the Sanitize Action field is set to 001b (i.e., Exit Failure Mode).
  • -a <action>, --sanact=<action> β€” Sanitize Action. here's the menu, bestie πŸŽ€:
    • 0x00 β†’ Reserved
    • 0x01 | exit-failure β†’ Exit Failure Mode
    • 0x02 | start-block-erase β†’ Start a Block Erase sanitize operation
    • 0x03 | start-overwrite β†’ Start an Overwrite sanitize operation
    • 0x04 | start-crypto-erase β†’ Start a Crypto Erase sanitize operation
    • 0x05 | exit-media-verification β†’ Exit Media Verification State
  • -p <overwrite-pattern>, --ovrpat=<overwrite-pattern> β€” Overwrite Pattern. this field is ignored unless the Sanitize Action field in Command Dword 10 is set to 011b (i.e., Overwrite). it specifies a 32-bit pattern that gets used for the Overwrite sanitize operation. ✨
  • -e, --emvs β€” Enter Media Verification State. if set, then the Media Verification state shall be entered if sanitize processing completes successfully. if cleared, this bit shall have no effect. and if the SANACT field does not specify starting a sanitize operation (i.e., is set to any value other than 010b, 011b, or 100b), then this bit shall be ignored by the controller. iykyk πŸ’…
  • -q, --preq β€” Purge Required. if set, the host is requesting that the user data be purged as defined by IEEE Std 2883. if the controller supports Sanitize Purge Request and Reporting (SPRRS in the Identify Controller data structure) and the sanitize operation started by this command does not purge user data, then that sanitize operation shall fail 😭 if cleared, then that sanitize operation is not required to purge user data as a condition for succeeding.
  • --force β€” ignore that the namespace is currently busy and perform the operation even though. πŸ”₯ (yes that's genuinely what it says, main character energy)
  • -w, --wait β€” wait for the sanitize to finish. sit there. be patient. 🧚
  • -r <repeat-count>, --repeat=<repeat-count> β€” repeat for the multi cycle sanitization. ⭐

✨ GLOBAL OPTIONS ✨

these are the options defined at the top-level nvme command, and they're available to this subcommand too 🫢

  • --dry-run β€” print the command that would be executed, but don't actually execute it. fake it till you make it, but safely 🌈
  • --no-ioctl-probing β€” disable probing for 64-bit IOCTL support.
  • --no-retries β€” disable retry logic on transient errors.
  • -o <fmt>, --output-format=<fmt> β€” set the reporting format to normal, tabular, 'json, or binary. only one output format may be used at a time. (yes, the original list has a stray quote on json β€” forwarding it exactly, character for character πŸ’€)
  • --output-format-version=<version> β€” select the output format version. version 1 uses the original field naming, while version 2 (the default) provides more consistent and script-friendly field names. other versions are rejected. periodt.
  • --quiet β€” suppress informational messages. errors are still reported, and --quiet cancels any --verbose for the library log level.
  • --set-options=<key=value>[,<key=value>...] β€” set libnvme library options for this invocation. the supported keys are force-4k, mi-probe-enabled, test-base-dir and test-sysfs-dir.
  • --timeout=<ms> β€” set the timeout for the command in milliseconds. infinite or -1 waits without a time limit (0xffffffff). ⏳
  • -v, --verbose β€” increase the level of detail in the output. may be specified multiple times to further increase verbosity. go off, stack those v's πŸ”₯

these options can also be set as machine-wide defaults in nvme-cli.conf(5). a command-line flag always overrides the file. always. no exceptions. πŸ‘‘


✨ EXAMPLES ✨

  • has the program issue a Sanitize Command πŸŽ€:
# nvme sanitize /dev/nvme0 -a 0x02
# nvme sanitize /dev/nvme0 --sanact=0x01
# nvme sanitize /dev/nvme0 --sanact=start-overwrite

✨ NVME ✨

part of the nvme-user suite. πŸ’œ


okay that's the whole page, bestie β€” go forth and sanitize responsibly πŸ¦‹

and the cute sign-off, as promised: this gem was dated 10/30/2026 and shipped under the source/version line NVMe (page NVME-SANITIZE(1), natch). mwah πŸ’‹

πŸ“¦ where this page comes from