Using intel Optane drive with lvmcache to cache root volume

Hello all! I’m not sure if “installation and boot” is the correct place to make this forum post, so please let me know if I need to change the tags.

My laptop (hp spectre eb000) comes with a 32gb (27gb in practice) intel optane drive alongside a 1tb ssd, used in Windows for the purpose of caching commonly used programs to make the experience feel snappier. Windows uses an intelRST driver to do this, requiring that the main drive and the optane drive are configured with RAID in the bios. This is not available on Linux, and I’ve already taken the steps to split the raid device up into two distinct AHCI(?) devices; they show up separately in linux.

When I first installed Manjaro to the laptop, I just wanted to get away from Windows as quickly as possible after it broke on me again so I didn’t bother with setting up the optane drive. Now that I’ve gained some more experience with Linux, I’m hoping to do a reinstall with a more complex setup, including using full disk encryption and making use of the optane drive for caching with lvmcache (I know there is less benefit in caching an SSD as opposed to an HDD, but it’s how the computer was sold and I can’t think of anything better to use the drive for).

I’ve gone through a test install in a virtual machine to make sure that my planned partitioning setup with LVM on LUKS would work for my main drive with Manjaro. By first partitioning the virtual disk in the KDE partition manager in the live environment and then using manjaro-architect for the install process, everything worked out fine and I had a working encrypted install on the VM. Using a smaller virtual disk as a mock optane drive, I then started following the steps in this article:

Everything seemed applicable to Manjaro up until the “do not reboot” section of the article— thin-provisioning-tools is available in the manjaro repos, but the manner in which the author of the article implemented their “thin-provisioning-tools” script as a hook for the initial ramdisk seems to be Ubuntu-specific. From what I’ve read, both Arch and Manjaro make use of mkinitcpio, but I haven’t had any experience with it up till now. I’m not sure how to modify the script that they provided to fit into the way that interfaces with Manjaro, or if it is even necessary- could the same thing be achieved by simply adding certain hooks to the HOOKS section in mkinitcpio.conf to load kernel modules? I’m not sure is relevant, but when going through the architect install on the VM, I forewent the option of including the fsck hook.

After taking a snapshot of the VM with the cache created, I tried rebooting without adding any of the hooks and the machine wouldn’t appear again, as warned of in the article- after unlocking the drive (presumably from GRUB as that was my chosen bootloader in architect), the VM dropped me into an emergency shell. On further tests, it wouldn’t even do that, simply leaving me on the virtualbox splashscreen.

Below is an approximation of how I’ve partitioned the VM, as I don’t have access to it at the moment; this isn’t the real output of an lsblk . The root LV is formatted in btrfs, and the home is in XFS. While I’d like to keep the root partition as btrfs for easier snapshotting with timeshift, I’m willing to change the home filesystem if needed; I mainly chose XFS since I saw that openSUSE does so.

NAME                   SIZE TYPE  MOUNTPOINT
sda                      8G disk  
├─sda1                 512M part  /boot/efi
└─sda2                 7.5G part  
  └─luks-encrypted-pv  7.5G crypt 
    ├─test-swap          1G lvm   [SWAP]
    ├─test-root          6G lvm   / 
    └─test-home        500M lvm   /home
sdb                      2G disk  

Is my proposed setup possible to attain on my actual hardware? How would I go about modifying the script “thin-provisioning-tools” from the article (not the actual package) to make it apply to manjaro? Are there other caveats that I haven’t taken into account yet? Thanks in advance for your help with this!


EDIT: I got access to my VM again so I was able to grab a real lsblk of the system with the cache setup:

NAME                                    MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINTS
sda                                       8:0    0    8G  0 disk  
├─sda1                                    8:1    0  512M  0 part  /boot/efi
└─sda2                                    8:2    0  7.5G  0 part  
  └─cryptroot                           254:0    0  7.5G  0 crypt 
    ├─test--vg-test--home               254:2    0  672M  0 lvm   /home
    ├─test--vg-testswap                 254:3    0  500M  0 lvm   [SWAP]
    └─test--vg-testroot_corig           254:7    0  6.3G  0 lvm   
      └─test--vg-testroot               254:1    0  6.3G  0 lvm   /
sdb                                       8:16   0    2G  0 disk  
└─sdbcrypt                              254:4    0    2G  0 crypt 
  ├─test--vg-root_cachepool_cpool_cdata 254:5    0    2G  0 lvm   
  │ └─test--vg-testroot                 254:1    0  6.3G  0 lvm   /
  └─test--vg-root_cachepool_cpool_cmeta 254:6    0    8M  0 lvm   
    └─test--vg-testroot                 254:1    0  6.3G  0 lvm   /
sr0                                      11:0    1 58.2M  0 rom   

Additionally, I got a screenshot of what happens after reboot: