What you can do in recent-ish LVM versions is create one “origin” LV on the HDD and one “cache pool” LV on the SSD,
and then combine it into a single “cache” LV.
It has the same size as the “origin” LV
(i. e., you only get as much space as is on the HDD),
but frequently used blocks and metadata are cached on the SSD to improve performance.
The gist of it is, assuming you already have a VG spanning both drives:
lvcreate -l 100%PVS -n your_name YourVG /dev/YourHDD
lvcreate --type cache-pool -l 100%PVS -n your_name_cache YourVG /dev/YourSSD
lvconvert --type cache --cachepool YourVG/your_name_cache YourVG/your_name
you will have a
your_name LV that you can use like any other LV,
and several internal LVs that you can see with
lvs -a YourVG.
I set up an encrypted root filesystem across an SSD partition (
and an HDD partition (
with the following commands:
pvcreate /dev/sda3 /dev/sdb1
vgcreate RootVG /dev/sda3 /dev/sdb1
lvcreate -l 100%PVS -n cryptroot RootVG /dev/sdb1
lvcreate --type cache-pool -l 100%PVS -n cryptroot_cache RootVG /dev/sda3
lvconvert --type cache --cachepool RootVG/cryptroot_cache RootVG/cryptroot
cryptsetup luksFormat --type luks2 /dev/RootVG/cryptroot
You can find more details on this blog post or this one. (The first one is what I used for reference and is also used as a reference on the LVM Wikipedia article; the second one is by me, describing how I used it in practice. Decide for yourself which one you want to trust 😉)