Rate This Document
Findability
Accuracy
Completeness
Readability

Installing and Configuring Bcache

Installing Bcache

Install the bcache.ko file, which you compiled in Compiling Bcache.

  1. Obtain the bcache.ko file.
  2. View the reference count of the bcache module.
    lsmod | grep -w bcache
    Check that the reference count is 0.
    bcache                458752  0
  3. Check that bcache.ko is not loaded in the current environment.
    modprobe -r bcache
    Alternatively,
    rmmod bcache
  4. Delete the installation directory.
    rm -rf /lib/modules/$(uname -r)/kernel/drivers/md/bcache
  5. Create an installation directory.
    mkdir -p /lib/modules/$(uname -r)/kernel/drivers/md/bcache
  6. Copy bcache.ko to the installation directory.
    cp bcache.ko /lib/modules/$(uname -r)/kernel/drivers/md/bcache
  7. Compress bcache.ko.
    xz -z /lib/modules/$(uname -r)/kernel/drivers/md/bcache/bcache.ko
  8. Update the dependency of bcache.ko.
    depmod -a
  9. Update bcache.ko in initramfs.
    dracut --add-drivers bcache -f /boot/initramfs-$(uname -r).img
  10. Check whether bcache.ko is successfully installed.

    If the two commands output the same file information, the installation is successful.

    • Command 1:
      lsinitrd /boot/initramfs-$(uname -r).img | grep bcache.ko.xz
      Command output:
      -rw-r--r-- 1 root root 997136 Nov 30 11:45 usr/lib/modules/4.14.0-115.el7a.0.1.aarch64/kernel/drivers/md/bcache/bcache.ko.xz
    • Command 2:
      ls -l /lib/modules/$(uname -r)/kernel/drivers/md/bcache/bcache.ko.xz
      Command output:
      -rw-r--r-- 1 root root 997136 Nov 30 11:45 /lib/modules/4.14.0-115.el7a.0.1.aarch64/kernel/drivers/md/bcache/bcache.ko.xz
  11. Load bcache.ko.
    modprobe bcache

Configuring Bcache

  1. In bcache.conf, set the load parameters of the bcache.ko module.
    If the value of acache_size is 20 MB, a 20 MB of physical memory is allocated to the bcache as the buffer for storing I/O information.
    echo "options bcache acache_size=20975616" > /etc/modprobe.d/bcache.conf