# Attaching Virtual Persistent Memory To Guests

The virtual persistent memory (vPMEM) feature in <code class="expression">space.vars.product\_name</code> enables administrators to configure vPMEMs for virtual machines using physical persistent memory (PMEM) that can provide virtual devices.

Note that the vPMEM feature is not enabled by default in your <code class="expression">space.vars.product\_name</code>. Contact your <code class="expression">space.vars.product\_name</code> support liaison if you would like this feature enabled.

### Pre-requisites

* Persistent Memory Hardware
* Following modules loaded at the linux kernel level for hypervisor hosts:

  `dax_pmem`, `nd_pmem`, `device_dax`, `nd_btt`

### Configure PMEM Namespaces

Your first step is to configure your PMEM namespaces as vPMEM backends using the `ndctl` utility.

```bash
$ sudo ndctl create-namespace -s 30G -m devdax -M mem -n ns3
{
  "dev":"namespace1.0",
  "mode":"devdax",
  "map":"mem",
  "size":"30.00 GiB (32.21 GB)",
  "uuid":"937e9269-512b-4f65-9ac6-b74b61075c11",
  "raw_uuid":"17760832-a062-4aef-9d3b-95ea32038066",
  "daxregion":{
    "id":1,
    "size":"30.00 GiB (32.21 GB)",
    "align":2097152,
    "devices":[
    {
      "chardev":"dax1.0",
      "size":"30.00 GiB (32.21 GB)"
    }
    ]
  },
  "name":"ns3",
  "numa_node":1
}
```

Now you can list the available PMEM namespaces on the host:

<pre class="language-bash"><code class="lang-bash"><strong>$ ndctl list -X
</strong>[
  {
    ...
    "size":6440353792,
    ...
    "name":"ns0",
    ...
  },
  {
    ...
    "size":6440353792,
    ...
    "name":"ns1",
    ...
  },
  {
    ...
    "size":6440353792,
    ...
    "name":"ns2",
    ...
  },
  {
    ...
    "size":32210157568,
    ...
    "name":"ns3",
    ...
  }
]
</code></pre>

### Configure Memory Resource Classes

Now that you have the namespaces created, the next step is to specify which PMEM namespaces should be available to virtual machines. You can do this by defining one or more PMEM resource classes in the compute service advance configuration [as specified here](https://docs.platform9.com/private-cloud-director/2025.10/nova-override#configure-pmem-namespace).

Make sure to restart the compute service on each host after doing the above configuration.

### Configure a flavor

Now that you have the required PMEM namespaces and classes configured, you can specify a comma-separated list of the `$LABEL`s that correspond to the resource classes you defined in the step above, to the flavor’s `hw:pmem` property. Multiple instances of the same label are permitted.

```bash
pcdctl flavor set --property hw:pmem='6GB' my_flavor
pcdctl flavor set --property hw:pmem='6GB,LARGE' my_flavor_large
pcdctl flavor set --property hw:pmem='6GB,6GB' m1.medium
```

Based on the above examples, a `pcdctl server create` request with `my_flavor_large` will spawn a new virtual machine with two vPMEMs. One, corresponding to the `LARGE` label, will be `ns3`; the other, corresponding to the `6G` label, will be arbitrarily chosen from `ns0`, `ns1`, or `ns2`.

\ <br>
