Installing and Configuring Bcache
Installing Bcache
Install the bcache.ko file, which you compiled in Compiling Bcache.
- Obtain the bcache.ko file.
- View the reference count of the bcache module.
lsmod | grep -w bcache
Check that the reference count is 0.bcache 458752 0
- Check that bcache.ko is not loaded in the current environment.
modprobe -r bcache
Alternatively,rmmod bcache
- Delete the installation directory.
rm -rf /lib/modules/$(uname -r)/kernel/drivers/md/bcache
- Create an installation directory.
mkdir -p /lib/modules/$(uname -r)/kernel/drivers/md/bcache
- Copy bcache.ko to the installation directory.
cp bcache.ko /lib/modules/$(uname -r)/kernel/drivers/md/bcache
- Compress bcache.ko.
xz -z /lib/modules/$(uname -r)/kernel/drivers/md/bcache/bcache.ko
- Update the dependency of bcache.ko.
depmod -a
- Update bcache.ko in initramfs.
dracut --add-drivers bcache -f /boot/initramfs-$(uname -r).img
- 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
- Command 1:
- Load bcache.ko.
modprobe bcache
Configuring Bcache
- 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
Parent topic: Compiling and Installing Software