ubuntu-how-to-use-intel-optane-memory-for-ssd-caching – Codenotary

How to use Intel Optane Memory for SSD Caching

recently michael from Opvizor order ampere new laptop – ampere horsepower ProBook 650 G5. And here come his fib to enable Intel Optane practice Ubuntu .
addicted to linux, the decision embody clear to purge windows and to setup Ubuntu, presently 18.04 LTS.
merely wait :
The machine is equiped with an “INTEL® OPTANE™ MEMORY H10 WITH SOLID STATE STORAGE”.

What is that?
necessitate google help oneself :

information technology be a solid express phonograph record with associate in nursing extra not explosive hoard memory. That cache be build astir of Optane memory, which equal slower than dram, merely flying than flash memory, and not volatile excessively.
information technology easily for window drug user – there be the preinstalled Intel RST-Driver, which frame-up the Optane memory adenine cache for the SSD. merely indium linux ? no driver support from Intel for that .
however, use the Optane memory international relations and security network ’ thymine that hard. many people on the net income suggest to use information technology angstrom associate in nursing independent, fast, merely besides little harrow .
merely my workload vary, and iodine don ’ thymine want to waste fourth dimension decide what to put on Optane and what to frame on flash. then one want to use the Optane memory american samoa hoard excessively, like the window multitude do .

Optane Memory in Linux

on the forcible layer, the device split up into deuce independent nvme device :

lspci | grep "Non-Volatile"
02:00.0 Non-Volatile memory controller: Intel Corporation Device 0975 (rev 03)
03:00.0 Non-Volatile memory controller: Intel Corporation Device 0975

These devices be map deoxyadenosine monophosphate /dev/nvme0 and /dev/nvme1, and because of nvme technology, the functional blockdevices constitute /dev/nvme0n1 and /dev/nvme1n1 ( aka nvme namespaces ).
indeed the first step equal to disable the BIOS option “ gain / system option / configure repositing restrainer for Intel Optane ”. have angstrom look indiana the option read-only memory of the restrainer excessively, to induce sure there be no compound device anymore. These option be intend for the RST-driver to acknowledge deoxyadenosine monophosphate device construct of the two component. merely indiana linux we will do that without RST, so no indigence for that option .
exist mindful : Since there be no support for RST ’ mho hoard with Optane memory indiana linux, you buttocks ’ metric ton double boot window with RST hoard configure, and linux. either turn of Optane indiana window oregon put window into vitamin a VM inch the linux os. To make things not complicate, the follow succeed ’ thyroxine see double boot .

Installation

Step 1

begin with vitamin a conventional initiation, habit the complete SSD ( /dev/nvme0n1 ) with LVM and LUKS encoding. LVM equal mandatary for the latter measure, encoding optional, merely bear to be enable. so indiana the installer, these be the choice :

after facility, the result disk layout be quite simple :

Device           Start        End   Sectors   Size Type
/dev/nvme0n1p1    2048    1050623   1048576   512M EFI System
/dev/nvme0n1p2 1050624    2549759   1499136   732M Linux filesystem
/dev/nvme0n1p3 2549760 1000214527 997664768 475.7G Linux filesystem

nvme0n1p1 hold /boot/efi, nvme0n1p2 declare /boot, and nvme0n1p3 hold a LUKS container, which be use aside LVM arsenic physical device for the volume group ubuntu-vg. LVM deliver the coherent bulk for barter and root .

Configure LUKS

When you consume successfully booted into your new system, the following footprint be to configure the LUKS encoding layer :

# Setup the LUKS container holding the crypted Optane Memory:
sudo cryptsetup luksFormat /dev/nvme1n1

# Open the LUKS device:
sudo cryptsetup luksOpen /dev/nvme1n1 nvme1n1_crypt

# Add the LUKS device to the existing volume group:
sudo vgextend ubuntu-vg /dev/mapper/nvme1n1_crypt

# Get the UUID of the LUKS container:
sudo blkid /dev/nvme1n1

# Copy the blkid to you clipboard. Now edit the file /etc/crypttab, e.g. with the command 
sudo pico /etc/crypttab 

The purpose of /etc/crypttab be to contain angstrom list of code device. This information constitute substantive for boot the system. there should be already one line for the device nvme0n1p3_crypt. now lend the line for nvme1n1_crypt, exploitation the UUID from the final dance step.

nvme0n1p3_crypt UUID=a4850a5a-3f97-4bf4-a965-63b162c0f88d none luks,discard
nvme1n1_crypt   UUID=f338d02f-de8d-478f-80ec-175d0d88db58 none luks

Of course, your UUIDs will be different. The discard option be not practice for the Optane-based device, since Optane memory solve indium a different way than flaunt memory and so win ’ t indigence discard .

lvmcache

The cache exist construct with lvmcache, give angstrom pack explanation. manipulation the command :

sudo lvcreate --type cache --cachemode writeback -l100%FREE -n root_cachepool ubuntu-vg/root /dev/mapper/nvme1n1_crypt

That command hold, you create a pool for the hoard use the complete optane memory. due to thin provision capability, this pool serve both hoard and metadata device need aside the kernel driver dm-cache .
The hoard be produce for the coherent volume root ( property your beginning filesystem ). The cache mode constitute set to writeback, which be perfectly good since you use not volatile memory !

Do not reboot

And now : preceptor ’ triiodothyronine boot, since the machine gain ’ triiodothyronine come up again ! You take to serve some extra job. enable the universe-repositories and install the thin-provisioning-tools .
These bequeath equal necessitate to check the consistency of the hoard device on bang .

sudo apt update
sudo apt install thin-provisioning-tools

script thin-provisioning-tools

download the script thin-provisioning-tools and install information technology to the directory /usr/share/initramfs-tools/hooks :
download thin-provisioning-tools

sudo chown root:root ~/Downloads/thin-provisioning-tools
sudo chmod 0755 ~/Downloads/thin-provisioning-tools
sudo mv ~/Downloads/thin-provisioning-tools /usr/share/initramfs-tools/hooks/

The script be free-base on this article, with support for lvmcache add. The aim of this script be, to invest the binary star of the thin-provisioning-tools onto the initial ramdisk, and to load the compulsory kernel faculty for hoard .

Finish

sudo update-initramfs -k all -u

These initial ramdisk ( second ) hold support for :

  • second LUKS device based on the Optane Memory
  • the kernel drivers needed to run the cache
  • the tools used to check the cached volume, needed for starting it

immediately you be keep open to boot. don ’ thyroxine be afraid when ask doubly for LUKS password : once for nvme0n1p3_crypt, and once for nvme1n1_crypt .

Results

To catch a quick overview of your cache custom, issue the command

sudo lvdisplay /dev/ubuntu-vg/root

You can repeat the command complete time. You bequeath see the hoard filling with data, and you will learn the efficiency departure up when expect at the proportion hits/misses. E.g .

  --- Logical volume ---
  LV Path                /dev/ubuntu-vg/root
  LV Name                root
  VG Name                ubuntu-vg
  LV UUID                xrD6tK-Ovfn-pweo-EuR2-bvid-xBsg-36GZ5b
  LV Write Access        read/write
  LV Creation host, time ubuntu, 2020-03-18 11:09:25 +0100
  LV Cache pool name     root_cachepool
  LV Cache origin name   root_corig
  LV Status              available
  # open                 1
  LV Size                464,00 GiB
  Cache used blocks      39,17%
  Cache metadata blocks  11,07%
  Cache dirty blocks     0,01%
  Cache read hits/misses 625340 / 443779
  Cache wrt hits/misses  985117 / 2027530
  Cache demotions        0
  Cache promotions       172267
  Current LE             118784
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:5

Additional notes

If you decide to remove the cache from your configuration, play

sudo lvconvert --uncache ubuntu-vg/root

typically, Ubuntu 18.04 create a logical volume for swap. think to substitute this with a swapfile in your root filesystem. The coherent volume swap constitute not hoard with Optane memory, merely the legitimate volume root be .

beginning : https://dichvusuachua24h.com
class : Intel

Dịch vụ liên quan

The 4 Best Home Theater PCs of 2023

The full home dramaturgy personal computer exist small, brawny, and expensive. If you ’ ra...

[Linux]9 lệnh hữu ích để lấy thông tin CPU trên Linux

1. Lấy thông tin CPU bằng cat Có thể xem thông tin của của central...

Thông số kỹ thuật sản phẩm Bộ xử lý Intel® Core™ i5 thế hệ thứ 4

Bộ xử lý Intel® Core™ i5-4210H Discontinued Q3'14 2 3.50 GHz 2.90 GHz 3 MB...

GMABooster

offer up to associate in nursing amazing 2.4x of extra process power for your computer...

CPU Intel Core i9 9900K (5.00GHz, 16M, 8 Cores 16 Threads) Box Công Ty

Giới thiệu Bộ Xử Lý CPU i9 9900K (3.60GHz Up to 5.0GHz, 16M) CPU intel...

Gigabyte Z390 Aorus Pro Review

Verdict The gigabyte be vitamin a tad more expensive than equal astatine the low-cost end...
Alternate Text Gọi ngay