Persistent memory (PMEM) sits between traditional DRAM and SSD storage — it provides byte-addressable access like RAM while retaining data across power cycles like flash. Managing PMEM on Linux requires specialized tooling. Three projects lead this space: ndctl (device-level management), PMDK (persistent memory development kit with libraries and tools), and memkind (memory allocator for heterogeneous memory systems).
This guide covers how to install, configure, and use each tool for managing persistent memory in self-hosted infrastructure environments.
What Is Persistent Memory?
Persistent memory modules (Intel Optane DC Persistent Memory, Samsung PMEM) plug into standard DDR4/DDR5 DIMM slots but behave differently from regular RAM. The Linux kernel exposes them through three access modes:
- Memory mode — PMEM acts as volatile RAM extension (transparent to applications, no data persistence)
- App Direct mode — applications access PMEM directly via memory-mapped files or DAX (Direct Access) filesystems
- Mixed mode — some regions in Memory mode, others in App Direct mode
For self-hosted infrastructure, App Direct mode is most interesting because it enables persistent data structures, fast restart recovery, and durable in-memory databases.
ndctl: Device-Level PMEM Management
ndctl (NVDIMM Control) is the primary command-line tool for managing NVDIMM (Non-Volatile DIMM) devices on Linux. It handles namespace creation, region configuration, firmware updates, and health monitoring. Developed by Intel and hosted at github.com/pmem/ndctl, it is the foundation tool that all other PMEM software depends on.
Installation
On Debian/Ubuntu:
| |
On RHEL/CentOS/Fedora:
| |
On Alpine Linux:
| |
Docker Deployment
ndctl requires direct access to NVDIMM devices and sysfs, so it runs best as a host-installed tool. For containerized management:
| |
Core Usage Patterns
List all NVDIMM devices and regions:
| |
Create a persistent namespace in App Direct mode:
| |
This creates a block device (/dev/pmem0) that supports DAX (Direct Access), allowing applications to bypass the page cache and access persistent memory directly.
Create a raw (sector) namespace for traditional block access:
| |
Create a device-dax namespace for character device access:
| |
Monitor NVDIMM health:
| |
Update NVDIMM firmware:
| |
Destroy a namespace:
| |
Strengths and Weaknesses
| Aspect | Details |
|---|---|
| Scope | Device-level management (regions, namespaces, DIMMs) |
| Application Support | None — purely infrastructure tool |
| DAX Support | Yes — creates DAX-enabled block and character devices |
| Health Monitoring | Yes — temperature, SMART data, error counts |
| Firmware Updates | Yes — in-place firmware flashing |
| Dependencies | Linux kernel with NVDIMM support (4.2+) |
PMDK: Persistent Memory Development Kit
PMDK (Persistent Memory Development Kit) is a collection of libraries and tools for building applications that use persistent memory. It includes libpmem (core PMEM access), libpmemobj (transactional object store), libpmemlog (persistent log), libpmemblk (persistent block store), and various utilities like pmemcheck and pmempool.
Installation
On Debian/Ubuntu:
| |
On RHEL/CentOS/Fedora:
| |
Build from source:
| |
Docker Deployment
| |
Core Usage Patterns
Write directly to persistent memory:
| |
Compile and run:
| |
Use the persistent object store:
| |
Strengths and Weaknesses
| Aspect | Details |
|---|---|
| Scope | Application-level (libraries for building PMEM-aware apps) |
| Transactions | Yes — libpmemobj provides ACID-like transactions |
| Language Support | C/C++ (primary), Python bindings available |
| Data Structures | Persistent linked lists, trees, hash maps |
| Debugging | pmemcheck (Valgrind-like tool for PMEM bugs) |
| Learning Curve | Steep — requires understanding of PMEM programming model |
memkind: Memory Allocator for Heterogeneous Memory
memkind is a user-extensible heap manager optimized for NUMA architectures and heterogeneous memory systems including persistent memory. It provides a malloc-compatible API that lets applications allocate memory from specific memory types (DRAM, PMEM, HBM) without changing application code.
Installation
On Debian/Ubuntu:
| |
On RHEL/CentOS/Fedora:
| |
Build from source:
| |
Docker Deployment
| |
Core Usage Patterns
Use memkind API directly:
| |
Use LD_PRELOAD for drop-in replacement:
| |
Strengths and Weaknesses
| Aspect | Details |
|---|---|
| Scope | Memory allocation layer (drop-in malloc replacement) |
| API Compatibility | malloc/free compatible — minimal code changes needed |
| NUMA Awareness | Yes — optimized for NUMA-aware allocation |
| PMEM Support | Yes — via MEMKIND_DAX_KMEM kind |
| HBM Support | Yes — high-bandwidth memory allocation |
| Transaction Support | No — pure allocator, no persistence guarantees |
Comparison Table
| Feature | ndctl | PMDK | memkind |
|---|---|---|---|
| Primary Role | Device management | Application libraries | Memory allocator |
| Abstraction Level | Lowest (kernel devices) | Mid (data structures) | Highest (malloc API) |
| Transactions | No | Yes (libpmemobj) | No |
| DAX Support | Yes (creates DAX devices) | Yes (uses DAX devices) | Yes (allocates on DAX) |
| Language | C CLI tool | C/C++ libraries | C library |
| Drop-in Usage | N/A | No | Yes (LD_PRELOAD) |
| Health Monitoring | Yes (SMART, temperature) | No | No |
| Namespace Mgmt | Yes (create/destroy) | No | No |
| GitHub Stars | 700+ | 1,300+ | 800+ |
| Best For | Sysadmins managing PMEM hardware | Developers building PMEM apps | Apps needing PMEM with zero code changes |
Choosing the Right PMEM Tool
These tools serve different roles in the PMEM stack — you will typically use all three together:
- ndctl provisions namespaces and creates DAX-enabled devices (
/dev/pmem0) - PMDK provides libraries for applications that need transactional persistence on PMEM
- memkind provides a drop-in allocator for applications that want PMEM benefits without code changes
Choose ndctl when:
- You need to create, configure, or destroy PMEM namespaces
- You want to monitor NVDIMM health and update firmware
- You are provisioning DAX block or character devices for applications
- You are the system administrator managing the physical PMEM hardware
Choose PMDK when:
- You are developing applications that require transactional persistence
- You need durable data structures (persistent hash maps, logs, object stores)
- You want fine-grained control over PMEM access patterns
- You can modify application source code to use PMDK libraries
Choose memkind when:
- You want to use PMEM without modifying application source code
- Your application uses
malloc/freeand you want PMEM-backed allocation - You need NUMA-aware memory allocation on heterogeneous systems
- You want a quick way to test PMEM benefits before committing to PMDK integration
Why Self-Host Persistent Memory Infrastructure
Running persistent memory management tools on your own servers delivers unique advantages for data-intensive workloads:
Sub-microsecond persistence. PMEM provides latency closer to DRAM (~100-300ns) than NVMe SSD (~10-50us). For self-hosted databases, key-value stores, and transaction logs, this means durable writes that are 100x faster than disk-backed alternatives.
Crash-consistent data structures. With PMDK’s transactional object store, your data structures survive power failures in a consistent state. No recovery journals, no replay logs — the data is simply there when the system boots. This eliminates the complex crash-recovery logic that traditional databases must implement.
Reduced infrastructure complexity. Persistent memory eliminates the need for separate caching layers (Redis, Memcached) for many workloads. Data lives in addressable memory and persists across reboots, combining the speed of in-memory storage with the durability of disk.
Data locality and compliance. For regulated industries (finance, healthcare, government), keeping sensitive data on-premises in PMEM — never written to external storage or transmitted over networks — simplifies compliance audits and reduces the attack surface.
Cost efficiency at scale. PMEM costs more per GB than DRAM but less than enterprise NVMe SSDs. For workloads that need both speed and persistence, PMEM can replace the combination of DRAM + battery-backed RAID, reducing total infrastructure cost by 30-50%.
For related memory optimization topics, see our Linux HugePages management guide and Linux compressed swap management. For kernel-level tracing of memory operations, our kernel dynamic tracing guide covers tools to monitor PMEM access patterns.
FAQ
What hardware do I need for persistent memory?
You need a server platform that supports NVDIMM (Non-Volatile DIMM) modules. Intel Optane DC Persistent Memory (100/200/300 series) was the most common option, though Intel discontinued the product line in 2025. Samsung and SK Hynix also produce PMEM modules. Your motherboard must support NVDIMM in the BIOS/UEFI, and the Linux kernel must be 4.2 or newer. For testing without hardware, PMDK provides a simulation mode (libpmemobj with PMEM_IS_PMEM_FORCE=1) that emulates PMEM using regular files.
Can I use persistent memory with Docker containers?
Yes. The key requirement is exposing the PMEM device (/dev/pmem0 or /dev/dax0.0) to the container and mounting a DAX-enabled filesystem inside it. Use --privileged or specific device capabilities (--device=/dev/pmem0). The Docker Compose examples in this guide show the full configuration. Note that PMEM-aware containers need the PMDK or memkind libraries installed inside the container image.
What filesystems support DAX (Direct Access)?
The main DAX-capable filesystems on Linux are ext4 (with the dax mount option), xfs (with dax or dax=always), and xfs with reflink support. The dax mount option bypasses the page cache, allowing applications to access PMEM directly through memory-mapped files. Without DAX, PMEM data goes through the kernel page cache, adding latency and losing the direct-access advantage.
Is persistent memory the same as NVDIMM?
NVDIMM is the hardware form factor (a DIMM module with non-volatile storage). Persistent memory is the general concept — NVDIMM is one implementation. Other PMEM implementations include M.2/NVMe devices with persistent memory semantics and CXL-attached memory. The ndctl tool manages NVDIMM devices specifically.
How does PMEM compare to battery-backed RAM?
Battery-backed RAM (BBU) uses regular DRAM with a battery that writes contents to flash on power loss. PMEM is inherently persistent — it does not need a battery because the memory cells retain data without power. PMEM is cheaper, more reliable, and faster to recover from power loss than BBU solutions.
What happens to PMEM data during a kernel crash?
Data in PMEM App Direct mode survives kernel crashes and power failures because the persistence is handled by the hardware, not the OS. However, any in-flight writes (data in CPU caches not yet flushed to PMEM) may be lost. PMDK’s pmem_persist() and pmem_memcpy_persist() functions ensure data is flushed through all cache levels to the persistent domain before returning.