5

I created a cache pool following this article. The process seems to be successful.

After doing an upgrade-grub and rebooting, Grub complains that it can not find the root volume (showing a UUID). - My bad, but I can not recall if this was the id of the original volume or the cached one.

The question: is there an article detailing the tasks to use the cached volume as the root?

6

The following Debian Forum topic and blog post based on it has the missing information.

Outline

-1) Back up your LVM configuration and have a like CD ready.

0) Make sure you have a separate /boot partition (your cached root will only be available later). This can be a 200MB partition and can be part of the same VG as your cached root.

1) You need dm-cache in your kernel image (instead of module). check your config and make sure you have CONFIG_DM_CACHE=y. If it is a module (=m) you will need to recompile a kernel where this is set to y. It is probably a good idea to use menuconfig and set this option from there (it will make sure dm-cache's dependency chain is also =y).

    Device Drivers  --->

    Generic Driver Options  --->

--- Multiple devices driver support (RAID and LVM)
<*>   Device mapper support
<*>     Cache target (EXPERIMENTAL)

2) Install thin-provisioning-tools (will do fsck-like functions on the cache at boot-time).

3) Create a file in /etc/initramfs-tools/hooks with the following content. This will make sure the executable from step 2 and some dependencies are inside your init ramdisk image.

#!/bin/sh

PREREQ="lvm2"

prereqs()
{
    echo "$PREREQ"
}

case $1 in
prereqs)
    prereqs
    exit 0
    ;;
esac

if [ ! -x /usr/sbin/cache_check ]; then
    exit 0
fi

. /usr/share/initramfs-tools/hook-functions

copy_exec /usr/sbin/cache_check

manual_add_modules dm_cache dm_cache_mq

4) Run update-initramfs -u -k all to re-generate all your initrd images.

  • Thanks for this answer it was very helpful. It allowed me to boot a Debian Squeeze system (armel on a QNAP NAS) with an SSD cache of a RAID 1 HDD which used LVM caching. Step 1 was not necessary just having the module in the initrd was enough. Also one of the module names has changed from dm_cache_mq to dm_cache_smq. – davefiddes Aug 7 '18 at 10:15
2

When using vbence's answer, also make the /etc/initramfs/hooks/ file from step 3 executable. Otherwise it won't get run by update-initramfs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.