I have an Ubuntu 18.04 PC with the following disk layout :
====================== lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 931,5G 0 disk └─sda1 8:1 0 931,5G 0 part └─md0 9:0 0 931,4G 0 raid1 ├─lvraid0-root 253:0 0 9,3G 0 lvm / ├─lvraid0-usr 253:1 0 26,4G 0 lvm /usr ├─lvraid0-boot 253:2 0 952M 0 lvm /boot ├─lvraid0-var 253:3 0 27,1G 0 lvm /var ├─lvraid0-local 253:4 0 3G 0 lvm /usr/local └─lvraid0-home 253:5 0 801,9G 0 lvm /home sdb 8:16 1 28,9G 0 disk ├─sdb1 8:17 1 2G 0 part /media/jan/Ubuntu 18.04.3 LTS amd └─sdb2 8:18 1 2,4M 0 part sdc 8:32 0 931,5G 0 disk └─sdc1 8:33 0 931,5G 0 part └─md0 9:0 0 931,4G 0 raid1 ├─lvraid0-root 253:0 0 9,3G 0 lvm / ├─lvraid0-usr 253:1 0 26,4G 0 lvm /usr ├─lvraid0-boot 253:2 0 952M 0 lvm /boot ├─lvraid0-var 253:3 0 27,1G 0 lvm /var ├─lvraid0-local 253:4 0 3G 0 lvm /usr/local └─lvraid0-home 253:5 0 801,9G 0 lvm /home sdd 8:48 0 238,5G 0 disk ├─sdd1 8:49 0 64G 0 part [SWAP] └─sdd2 8:50 0 174,5G 0 part ===================
In order to speed up disk access I configured
lvm2 to use
/dev/sdd2 (SSD) as a cache volume using
lvmcache. I first tried caching all lvm volumes. That did not go well.
update-grub there ware a lot of errors which disappeard when I removed the cache on boot volume. After this I did a
update-initramfs -u -k all and
update-grub and all, looked well and the caching worked like a charm with impressive speed.
Now boot - disaster ! No boot. I got some messages that the kernel did not support caching or something like that, and complaints that the boot process could not connect to
lvmetad (it complained about even before, but lvm scanning found lvm volumes).
Luckily I ended up in an
initramfs busybox. I had never heard of that before, but it had an lvm command that allowed me to use regular lv- type commands like
lvremove and after removing cache volumes I was able to boot.
To make a long story relatively short, I tried to limit lvm caching to only one of volumes (not boot) but in all cases booting failed in some way.
Now as shown in the
lsblk output, I have a raid1 disk
/dev/md0 made from two seagate hdds, and on top of that I have created a number of lvm volumes.
I would hope someone have a trick up their sleeve to enable the lvm cache to boot - and if possible also fix the
lvmetad boot problem. I should add that I also tried to add modules to
/etc/initramfs-tools/modules. I added
dm-cache.ko and it may have changed the boot problem nature (I dont have an exact description)