NVMe Storage Administration
NVMe (Non-Volatile Memory Express) is the storage protocol used by modern SSDs that connect via PCIe. NVMe drives are fundamentally different from SATA SSDs — they have much lower latency, higher IOPS, and different device naming conventions. Most cloud VMs and modern bare-metal servers use NVMe storage, so understanding how to administer NVMe devices on Ubuntu is increasingly essential.
NVMe vs SATA SSD
| Metric | SATA SSD | NVMe SSD |
|---|---|---|
| Interface | SATA (6 Gbps max) | PCIe 3.0 x4 (32 Gbps), PCIe 4.0 x4 (64 Gbps) |
| Sequential read | ~550 MB/s | 3,000–7,000+ MB/s |
| Sequential write | ~520 MB/s | 2,000–5,000+ MB/s |
| Random read IOPS | ~100K IOPS | 500K–1M+ IOPS |
| Latency | 50–100 μs | 20–50 μs |
| Device name | /dev/sda, /dev/sdb | /dev/nvme0n1, /dev/nvme1n1 |
NVMe device naming
NVMe device naming convention:
/dev/nvme0n1 ← Controller 0, Namespace 1 (the storage device)
/dev/nvme0n1p1 ← Controller 0, Namespace 1, Partition 1
/dev/nvme1n1 ← Controller 1, Namespace 1 (second NVMe device)
nvme0 = first NVMe controller (physical device)
n1 = namespace 1 (logical block address space — usually 1 per device)
p1 = partition 1 within the namespace# List all NVMe devices
ls /dev/nvme*
lsblk | grep nvme
# NVMe tools
sudo apt install -y nvme-cli
# List all NVMe devices with details
sudo nvme list
nvme list output
Node SN Model Namespace Usage Format
/dev/nvme0n1 S6XXNX0T800000 Samsung SSD 980 PRO 1 512.11 GB 512 B + 0 B
NVMe health monitoring
# Show NVMe SMART/health data
sudo nvme smart-log /dev/nvme0n1
nvme smart-log output (key fields)
Smart Log for NVME device:/dev/nvme0n1 namespace-id:ffffffff
critical_warning : 0 ← 0 = no warnings
temperature : 38 C ← Operating temperature
available_spare : 100% ← % spare blocks left
available_spare_threshold : 10% ← Alert below this
percentage_used : 0% ← Drive wear (100% = end of life estimate)
data_units_read : 1,234,567
data_units_written : 2,345,678
power_on_hours : 1,234
unsafe_shutdowns : 5
# Get specific health field
sudo nvme smart-log /dev/nvme0n1 | grep "percentage_used"
# Check error log
sudo nvme error-log /dev/nvme0n1
# Verify data integrity (end-to-end data protection)
sudo nvme sanitize-log /dev/nvme0n1
NVMe performance tuning
# Check current I/O scheduler (NVMe should use 'none')
cat /sys/block/nvme0n1/queue/scheduler
Expected output for NVMe
[none] mq-deadline kyber bfq
# 'none' is already selected (in brackets) — correct for NVMe
# NVMe has its own internal queuing (thousands of queues vs 1 for SATA)
# The 'none' scheduler lets NVMe manage its own queue — correct setting
# Check queue depth
cat /sys/block/nvme0n1/queue/nr_requests # Typically 1023 for NVMe
# Enable TRIM support for NVMe
# In /etc/fstab, add 'discard' option:
UUID=... /data ext4 defaults,noatime,discard 0 2
# Or schedule periodic TRIM (less write amplification)
sudo systemctl enable --now fstrim.timer
sudo systemctl status fstrim.timer
NVMe namespace management
# List namespaces on an NVMe controller
sudo nvme list-ns /dev/nvme0
# Show namespace details
sudo nvme id-ns /dev/nvme0n1
# Partitioning NVMe is the same as SATA — use fdisk or parted
sudo fdisk /dev/nvme0n1 # Same commands as with /dev/sdb
sudo parted -s /dev/nvme0n1 mklabel gpt mkpart primary ext4 0% 100%
# Format partition (note: nvme0n1p1, not nvme0n11)
sudo mkfs.ext4 /dev/nvme0n1p1
Conclusion
NVMe administration is largely the same as SATA disk administration — fdisk, parted, mkfs, mount, fstab — but with different device names (/dev/nvme0n1 instead of /dev/sda). Install nvme-cli for health monitoring via nvme smart-log. The I/O scheduler should be none for NVMe (the default). Enable TRIM with the discard mount option or use fstrim.timer for periodic TRIM. Monitor percentage_used in smart-log to track drive wear — replace the drive before it reaches 100%.
Need help with Ubuntu administration?
Work directly with Muhammad Irfan Aslam for Ubuntu Server, Linux, cloud, Docker, DevOps, CI/CD, or infrastructure troubleshooting support.
Work with Muhammad Irfan Aslam