Mount persistent memory (PMEM)
1. Install virtual machine (bridge network mode)
-
Select [typical (recommended)] to proceed to the next step
-
Select the installation operation later and click next
-
Select [client operating system - Linux, version CentOS 7 64 bit], next
-
Virtual machine naming, next step
-
[maximum disk size - 60G, split the virtual disk into multiple files] (note that the disk size is not easy to be too small for kernel experiments)
-
[custom hardware]
-
[memory - 4GB]
-
[number of processors - 2, number of cores - 2], check [virtualization Intel VT-x/EPT or AMD-V/RVI]
-
Use the ISO image file to locate the downloaded ISO file of CentOS
-
Network adapter select bridge mode
-
Click close to finish the final configuration preview, and click finish
-
Start the virtual machine and click enter
-
Select Chinese for configuration text
-
Configure [software selection], select [server with GUI], and [finish] in the upper left corner
-
Configuration [installation location]
-
Select [I want to configure partition] and [finish] in the upper left corner
-
Select [standard partition] and click [+] to add the mount point (note that the experiment of compiling the kernel should not add too small memory to / boot)
-
Finish, accept changes
-
Start installation (set root password, create user)
-
Configure bridge network
-
Configuration Bridge
vi /etc/sysconfig/network-scripts/ifcfg-cloudbr0
Insert:
#[ifcfg-cloudbr0], there was no such file originally DEVICE=cloudbr0 TYPE=Bridge ONBOOT=yes BOOTPROTO=static IPV6INIT=no IPV6_AUTOCONF=no DELAY=5 IPADDR=192.168.1.2[Of the same network segment as the host ip Address] GATEWAY=192.168.1.1[gateway xxx.xxx.xxx.1] NETMASK=255.255.255.0 DNS1=8.8.8.8 DNS2=8.8.4.4 STP=yes USERCTL=no NM_CONTROLLED=no # Remember to delete these comments
-
Modify network configuration
vi /etc/sysconfig/network-scripts/ifcfg-ens33.
Amend to read:
TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=none DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=no IPV6_AUTOCONF=no IPV6_DEFROUTE=no IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=ens33 UUID=522f2028-1e48-421b-9c25-aef00237719d DEVICE=ens33 ONBOOT=yes BRIDGE=cloudbr0
-
Restart the network
chkconfig network on systemctl stop NetworkManager systemctl disable NetworkManager systemctl restart network
-
##2. Compile kernel enable PMEM module
-
Download kernel
The kernel can be downloaded through the official Linux website or through some domestic websites.
Recommended kernel version: linux-4.16.10
Compressed package after downloading: linux-4.16.10 tar. gz
-
Unzip (unzip the compressed package to / usr/src directory)
tar xf linux-4.16.10.tar.gz -C /usr/src
-
Configure kernel
cd linux-4.16.10
Enter the extracted kernel version directory and execute the following command
make menuconfig
Note that some packages need to be installed before the command is executed (if a package is still missing, just install it according to the prompt)
yum install gcc yum install ncurses ncurses-devel
To enter the graphical configuration interface, you need to be able to PMEM module
-> Device Drivers -> NVDIMM Support -> <M>PMEM; <M>BLK; <*>BTT //Adjust by space
//Back to the home page -> Processor type and features <*>Support non-standard NVDIMMs and ADR protected memory
-
Compile kernel
make -j4 //j4 means that four compilation commands are executed at the same time. j8 can be used on 4-core machines //Similarly, if any package is missing, install it according to the prompt
-
Compiling and installing modules
make modules make modules_install
-
Modify grub file
nano /etc/default/grub
Add as follows:
memmap=nn[KMG]!ss[KMG] #Allocate the memory area as PMEM, ss represents the starting memory address, and nn represents the area size, such as 4G!12G represents the memory range from 12G to 16G as PMEM [KMG] indicates KB,MB,GB The details are as follows: GRUB_CMDLINE_LINUX="memmap=4G!4G"
-
Update grub file
//CentOS instruction grub2-mkconfig -o /boot/grub2/grub.cfg //If the user is ubuntu update-grub2
-
Restart the virtual machine
reboot
Select the corresponding compiled kernel system
After restart, check the drive directory dev to see that PEME0 has been successfully mountedls /dev
Mount succeeded
3. Configure the persistent memory as a local disk
-
Install persistent memory management tools
yum install -y ndctl daxctl
-
The configuration usage mode is fsdax
ndctl create-namespace -f -e namespace0.0 --mode=fsdax
-
Format and mount the disk
mkfs -t ext4 /dev/pmem0 mount -o dax,noatime /dev/pmem0 /mnt
-
View mounted disks
df -h
Configuration succeeded
-
be careful
Note that after the virtual machine is mounted, the mount information will be lost every time the virtual machine is shut down, and it needs to be mounted again after restart.