How to Check if an EC2 NVMe Device is EBS or Instance Store?

You can determine whether an NVMe block device on an Amazon EC2 Linux instance is an Amazon Elastic Block Store volume or an ephemeral instance store volume by inspecting its hardware model name and vendor-specific metadata. Because AWS Nitro-based instances expose both storage types through the NVMe interface using identical device naming conventions like nvme0n1 and nvme1n1, checking the device path alone is insufficient. Standard Linux utilities such as lsblk, nvme-cli, and Amazon EC2 udev scripts allow administrators to quickly query the controller model string and serial number to distinguish persistent EBS storage from temporary instance store disks before formatting or mounting file systems.

Why Device Names Cannot Identify Storage Type

On modern AWS Nitro System instances, both Amazon EBS volumes and local EC2 instance store volumes are attached to the guest operating system through virtualized Non-Volatile Memory Express (NVMe) controllers. During the boot sequence, the Linux kernel enumerates NVMe namespaces asynchronously as they respond, assigning sequential device node names such as /dev/nvme0n1, /dev/nvme1n1, and /dev/nvme2n1.

Because device enumeration order is non-deterministic across reboots, /dev/nvme0n1 might correspond to your root EBS volume on one boot and a local ephemeral NVMe drive on the next. Relying on the device node name without verifying the underlying controller attributes risks writing persistent data to ephemeral storage that is wiped when the instance stops, or misconfiguring RAID arrays and fstab entries.

Method 1: Using lsblk to Inspect the Model String

The fastest built-in method on almost any Linux distribution is to query the block device MODEL attribute using lsblk. The AWS Nitro hypervisor populates the NVMe controller model field with distinct strings for each storage backend:

  • Amazon Elastic Block Store indicates a persistent EBS volume.
  • Amazon EC2 NVMe Instance Storage indicates an ephemeral local instance store volume.

Run the following command to list all block devices alongside their model and serial numbers:

lsblk -o NAME,SIZE,TYPE,MOUNTPOINT,MODEL,SERIAL

Example output on an instance with both EBS and instance store volumes attached:

NAME        SIZE TYPE MOUNTPOINT MODEL                            SERIAL
nvme0n1      20G disk            Amazon Elastic Block Store       vol0123456789abcdef0
└─nvme0n1p1  20G part /
nvme1n1     100G disk /data      Amazon Elastic Block Store       vol0fedcba9876543210
nvme2n1     440G disk            Amazon EC2 NVMe Instance Storage AWS1A2B3C4D5E6F7G8H9

In this output:

  1. nvme0n1 and nvme1n1 show the model Amazon Elastic Block Store and serial numbers prefixed with vol (which directly map to vol-0123456789abcdef0 and vol-0fedcba9876543210 in the AWS Console).
  2. nvme2n1 displays Amazon EC2 NVMe Instance Storage and a serial number prefixed with AWS, confirming it is an instance store volume.

Method 2: Using the nvme-cli Utility

The nvme-cli package queries the NVMe controller registers directly. To list all connected NVMe devices and view their model strings and serial numbers, execute nvme list with root privileges:

sudo nvme list

Example output:

Node             SN                   Model                                    Namespace Usage                      Format           FW Rev
---------------- -------------------- ---------------------------------------- --------- -------------------------- ---------------- --------
/dev/nvme0n1     vol0123456789abcdef0 Amazon Elastic Block Store               1          21.47  GB /  21.47  GB    512   B +  0 B   1.0
/dev/nvme1n1     vol0fedcba9876543210 Amazon Elastic Block Store               1         107.37  GB / 107.37  GB    512   B +  0 B   1.0
/dev/nvme2n1     AWS1A2B3C4D5E6F7G8H9 Amazon EC2 NVMe Instance Storage         1         472.44  GB / 472.44  GB    4.00 KiB +  0 B  0

For deeper inspection of a specific EBS volume—such as discovering the legacy block device mapping (like /dev/sdf or /dev/xvda) configured in the EC2 block device mapping—you can inspect the vendor-specific bytes of the NVMe controller identification structure:

sudo nvme id-ctrl -v /dev/nvme1n1

On an EBS volume, the vs (vendor specific) section at the bottom of the output decodes the ASCII string of the block device name specified during attachment (for example, sdf). On an instance store volume, this vendor-specific block device mapping metadata is either empty or contains internal instance storage identifiers (ephemeral0, ephemeral1, etc.).

Method 3: Reading Kernel sysfs Attributes Directly

If you are working inside a minimal container environment or rescue shell where nvme-cli is not installed and lsblk flags are limited, you can read the device attributes directly from the Linux kernel sysfs virtual filesystem under /sys/class/block/:

for dev in /sys/block/nvme*; do
    name=$(basename "$dev")
    model=$(cat "$dev/device/model" | tr -s ' ')
    serial=$(cat "$dev/device/serial" | tr -d ' ')
    printf "%-10s | %-34s | %s\n" "$name" "$model" "$serial"
done

Example output:

nvme0n1    | Amazon Elastic Block Store         | vol0123456789abcdef0
nvme1n1    | Amazon Elastic Block Store         | vol0fedcba9876543210
nvme2n1    | Amazon EC2 NVMe Instance Storage   | AWS1A2B3C4D5E6F7G8H9

Checking /sys/block/<device>/device/model requires no root permissions and works reliably across all modern Linux kernels.

Method 4: Using AWS ebsnvme-id on Amazon Linux and Ubuntu

Amazon Linux, Ubuntu AWS images, and RHEL AMIs pre-install the amazon-ec2-utils (or ec2-utils) package, which includes the /sbin/ebsnvme-id helper tool used by udev rules. Running this tool against an NVMe device node immediately identifies whether the target device is an EBS volume or an instance store volume:

sudo /sbin/ebsnvme-id /dev/nvme1n1

If the device is an EBS volume, ebsnvme-id outputs the formatted volume ID and the block device mapping name:

Volume ID: vol-0fedcba9876543210
sda1

If the device is an instance store volume, ebsnvme-id exits with a message indicating it is not an EBS device:

sudo /sbin/ebsnvme-id /dev/nvme2n1
/dev/nvme2n1: Not an EBS device

Comparison of EC2 NVMe Device Attributes

Attribute Amazon EBS Volume EC2 Instance Store Volume
NVMe Model String Amazon Elastic Block Store Amazon EC2 NVMe Instance Storage
Serial Number Prefix vol (e.g., vol0123456789abcdef0) AWS (e.g., AWS1A2B3C4D5E6F7G8H9)
Data Persistence Persists across instance stops and reboots Ephemeral; persists across reboots, lost on stop/termination
ebsnvme-id Output Returns Volume ID: vol-... and device name Returns Not an EBS device
By-ID Symlink Pattern /dev/disk/by-id/nvme-Amazon_Elastic_Block_Store_vol* /dev/disk/by-id/nvme-Amazon_EC2_NVMe_Instance_Storage_AWS*

Best Practice for Mounting Volumes in /etc/fstab

To avoid mounting the wrong NVMe device after an instance stop/start cycle, never reference /dev/nvmeXn1 directly in /etc/fstab or automation scripts. Instead, mount file systems using their file system UUID (retrieved via blkid) or use the persistent /dev/disk/by-id/ symbolic links generated by udev, which incorporate the NVMe model name and serial number directly into the path.