Skip to content

Instantly share code, notes, and snippets.

@wojtuss
Created May 23, 2017 10:41
Show Gist options
  • Save wojtuss/ababfaa0d867d97f9cbd65d5a336a532 to your computer and use it in GitHub Desktop.
Save wojtuss/ababfaa0d867d97f9cbd65d5a336a532 to your computer and use it in GitHub Desktop.
device dax setup commands
Assuming your linux kernel supports Device DAX properly, the following describes a full procedure of how to set up 2 Device DAXes of 1G and 2G sizes on a machine with 32G RAM.
1. Configure grub.
Add the following line to /etc/default/grub:
GRUB_CMDLINE_LINUX="memmap=1G!31G memmap=2G!29G"
(meaning: take 1G after 31G of your RAM and 2G after 29G of RAM, which makes the last 3G of your RAM devoted to Device DAXex)
2. Update grub.
$ sudo update-grub2
3. Reboot.
4. Check.
After issuing
$ dmesg | grep user
one should see two persistent items to the bottom of the output
[ 0.000000] user: [mem 0x0000000740000000-0x00000007bfffffff] persistent (type 12)
[ 0.000000] user: [mem 0x00000007c0000000-0x00000007ffffffff] persistent (type 12)
5. List namespaces.
$ ndctl list
The output should look like this:
[
{
"dev":"namespace1.0",
"mode":"memory",
"size":1073741824,
"blockdev":"pmem1"
},
{
"dev":"namespace0.0",
"mode":"memory",
"size":2147483648,
"blockdev":"pmem0"
}
]
6. Create Device DAXes
For each namespace issue:
$ sudo ndctl create-namespace -e namespace0.0 -f -m dax
7. Check.
Listing namespaces now should output:
$ ndctl list
[
{
"dev":"namespace1.0",
"mode":"dax",
"size":1054867456,
"uuid":"e43118fc-b52b-48e1-af40-9ea28132cd19",
"daxdevs":[
{
"chardev":"dax1.0",
"size":1054867456
}
]
},
{
"dev":"namespace0.0",
"mode":"dax",
"size":2111832064,
"uuid":"3072d0ed-b86b-4bfa-bbc8-f91b9941bdbb",
"daxdevs":[
{
"chardev":"dax0.0",
"size":2111832064
}
]
}
]
Also
$ ls /dev/dax*
should list the devices:
/dev/dax0.0
/dev/dax1.0
Note: the newly created Device DAXes are owned by root. It may be necessary to chown them before running any tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment