NVME-FORMAT(1)
π NVME-FORMAT π
okay bestie, this is the nvme-format page from the NVMe Manual β yes, that one, the "please don't nuke my drive" one. Buckle up π
β¨ NAME β¨
nvme-format β Format an NVMe device
πΈ SYNOPSIS πΈ
nvme [<global-options>] format <device> [--namespace-id=<nsid> | -n <nsid>]
[--lbaf=<lbaf> | -l <lbaf>]
[--block-size=<block size | -b <block size>]
[--ses=<ses> | -s <ses>] [--pil=<pil> | -p <pil>]
[--pi=<pi> | -i <pi>] [--ms=<ms> | -m <ms>]
[--reset | -r] [--force]
π¦ DESCRIPTION π¦
So for the NVMe device you hand it, this bad boy sends an nvme Format Namespace admin command and gives you back the results. Slay. β¨
The <device> parameter is mandatory β like, non-negotiable β and it can be either the NVMe character device (ex: /dev/nvme0) or a namespace block device (ex: /dev/nvme0n1). Here's the tea on how it behaves:
- If you give it the character device and the controller does not support formatting of particular namespaces (
ID_CTRL.FNAbit 0 enabled), then all namespaces get formatted. - If FNA is disabled, then you must specify the namespace identifier with the
namespace-idoption β or pass a value of0xffffffffto send the format to all namespaces. - If you give it the block device, the namespace identifier defaults to the namespace ID of the block device you gave, but you can override it with that same option. π
β οΈ okay listen, this next part is SO important. The numeric suffix on the character device β like the0in/dev/nvme0β does NOT mean this device handle is the parent controller of any namespaces with the same suffix. The namespace handle's numeral may be coming from the subsystem identifier, which is independent of the controller's identifier. Do not assume any particular device relationship based on their names. If you do, you may irrevocably erase data on an unintended device. πππ I am not joking, bestie. That is your whole life's work gone. fr fr.
On success, the program will automatically issue a BLKRRPART ioctl to force rescanning the namespaces. π§ If the driver is recent enough, this will automatically update the physical block size. If it is not recent enough, you'll need to remove and rescan your device some other way for the new block size to be visible β that's only if the size was changed with this command, no cap.
β OPTIONS β
-n <nsid>,--namespace-id=<nsid>β Send the format command for the specified nsid. This can be used to override the default value for either the character device (which is unspecified) or the block device (which is the result fromNVME_IOCTL_ID). The broadcast value0xffffffffcan also be given asallor-1. π-l <lbaf>,--lbaf=<lbaf>β LBA Format: this field specifies the LBA format to apply to the NVM media. It corresponds to the LBA formats indicated in the Identify Namespace command. Conflicts with the--block-sizeargument. Defaults to0. π-b <block size>,--block-size=<block size>β Block Size: this field is used to specify the target block size to format to. Potential lbaf values will be scanned and the lowest numbered one will be selected for the format operation. Conflicts with the--lbafargument. π¦-s <ses>,--ses=<ses>β Secure Erase Settings: this field specifies whether a secure erase should be performed as part of the format, and the type of the secure erase operation. The erase applies to all user data, regardless of location (e.g., within an exposed LBA, within a cache, within deallocated LBAs, etc). Defaults to0.
So the values are giving:
0β No secure erase operation requested1β User Data Erase: all user data shall be erased, and the contents of the user data after the erase is indeterminate (e.g., the user data may be zero filled, one filled, etc). The controller may perform a cryptographic erase when a User Data Erase is requested if all user data is encrypted. π₯2β Cryptographic Erase: all user data shall be erased cryptographically. This is accomplished by deleting the encryption key.3β7β Reserved
-p <pil>,--pil=<pil>β Protection Information Location: if set to1and protection information is enabled, then protection information is transferred as the first bytes of metadata. If cleared to0and protection information is enabled, then protection information is transferred as the last bytes of metadata. Defaults to0. β¨-i <pi>,--pi=<pi>β Protection Information: this field specifies whether end-to-end data protection is enabled, and the type of protection information. Defaults to0. π
The values, bestie:
0β Protection information is not enabled1β Protection information is enabled, Type 12β Protection information is enabled, Type 23β Protection information is enabled, Type 34β7β Reserved
-m <ms>,--ms=<ms>β Metadata Settings: this field is set to1if the metadata is transferred as part of an extended data LBA. It's cleared to0if the metadata is transferred as part of a separate buffer. The metadata may include protection information, based on the Protection Information (PI) field. Defaults to0. πΈ-r,--resetβ Issue a reset after successful format. Must use the character device for this one. β--forceβ Just send the command immediately without warning of the implications. π (yes that's the whole description. iconic honestly.)
π GLOBAL OPTIONS π
The following options are defined at the top-level nvme command and are available to this subcommand:
--dry-runβ Print the command that would be executed, but don't actually execute it. π--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 tonormal,tabular,json, orbinary. Only one output format may be used at a time. π--output-format-version=<version>β Select the output format version. Version 1 uses the original field naming, while version 2 (default) provides more consistent and script-friendly field names. Other versions are rejected. π«Ά--quietβ Suppress informational messages. Errors are still reported, and--quietcancels any--verbosefor the library log level.--set-options=<key=value>[,<key=value>...]β Set libnvme library options for this invocation. Supported keys areforce-4k,mi-probe-enabled,test-base-dirandtest-sysfs-dir.--timeout=<ms>β Set the timeout for the command in milliseconds.infiniteor-1waits without a time limit (0xffffffff). β-v,--verboseβ Increase the level of detail in the output. May be specified multiple times to further increase verbosity. π
These options can also be set as machine-wide defaults in nvme-cli.conf(5). A command-line flag always overrides the file. β¨
π EXAMPLES π
- Format the device using all defaults:
# nvme format /dev/nvme0n1
- Format namespace 1 with user data secure erase settings and protection information:
# nvme format /dev/nvme0 --namespace-id=1 --ses=1 --pi=1
π§ NVME π§
Part of the nvme-user suite π
and that's the whole page, bestie β go forth and format responsibly π this was NVMe documentation, dated 10/30/2026, page NVME-FORMAT(1). mwah π
π¦ where this page comes from
- arch rolling: nvme-cli 3.2-1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms