bcache模块官方文档:
https://www.kernel.org/doc/Documentation/bcache.txt
一、 默认3.10内核不包含bcache模块,需要手动编译ko文件。
1. 首先确认内核版本 uname -r
2. 安装编译内核的必要工具
yum groupinstall "Development Tools" -y
yum install kernel-headers -y
3. 下载内核源码包并解包,以3.10.0-693内核版本为例
mkdir kernel
cd kernel
wget http://vault.centos.org/7.4.1708/os/Source/SPackages/kernel-3.10.0-693.el7.src.rpm
rpm2cpio ./kernel-3.10.0-693.el7.src.rpm | cpio -idmv
4. 修改bcache编译选项后编译内核
sudo sh -c 'yes "" | make oldconfig'
vi .config修改下面一行
cd drivers/md/bcache/
xz -z bcache.ko
cp bcache.ko.xz /usr/lib/modules/3.10.0-693.el7.x86_64/kernel/drivers/md/
depmod -A
modinfo bcache
modprobe -f bcache
6. 使bcache模块开机加载
#cd /etc/sysconfig/modules/
#vim bcache.modules
在文件中添加如下内容
#!/bin/sh
/sbin/modprobe -f bcache
#chmod 755 bcache.modules //这一步至关重要
#reboot
二、 bcache的管理依赖用户态程序bcache-tools,需要先编译打rpm包
1.获取源码:
git clone https://github.com/g2p/bcache-tools.git
2.打包
yum install uuid-devel openssl libblkid-devel udev
根据Makefile自己写一个bcache-tools.spec
rpmbuild -ba bcache-tools.spec
三、 ############### 在CentOS7上进行安装 ##################
1.在CentOS7.3及以下版本,先升级内核版本到3.10.0-693,CentOS7.4无需升级
rpm -Uvh kernel*
2.安装bcache内核模块并启动加载
cp bcache.ko.xz /usr/lib/modules/3.10.0-693.el7.x86_64/kernel/drivers/md/
echo "#!/bin/sh" > /etc/sysconfig/modules/bcache.modules
echo "/sbin/depmod -A" >> /etc/sysconfig/modules/bcache.modules
echo "/sbin/modprobe -f bcache" >> /etc/sysconfig/modules/bcache.modules
chmod 755 /etc/sysconfig/modules/bcache.modules
3.安装bcache-tools,rpm由上面的步骤打包产生
rpm -ivh bcache-tools-1.0.8-1.el7.x86_64.rpm
4. reboot
https://www.kernel.org/doc/Documentation/bcache.txt
一、 默认3.10内核不包含bcache模块,需要手动编译ko文件。
1. 首先确认内核版本 uname -r
2. 安装编译内核的必要工具
yum groupinstall "Development Tools" -y
yum install kernel-headers -y
3. 下载内核源码包并解包,以3.10.0-693内核版本为例
mkdir kernel
cd kernel
wget http://vault.centos.org/7.4.1708/os/Source/SPackages/kernel-3.10.0-693.el7.src.rpm
rpm2cpio ./kernel-3.10.0-693.el7.src.rpm | cpio -idmv
4. 修改bcache编译选项后编译内核
sudo sh -c 'yes "" | make oldconfig'
vi .config修改下面一行
CONFIG_BCACHE=m
make
cd drivers/md/bcache/
xz -z bcache.ko
cp bcache.ko.xz /usr/lib/modules/3.10.0-693.el7.x86_64/kernel/drivers/md/
depmod -A
modinfo bcache
modprobe -f bcache
6. 使bcache模块开机加载
#cd /etc/sysconfig/modules/
#vim bcache.modules
在文件中添加如下内容
#!/bin/sh
/sbin/modprobe -f bcache
#chmod 755 bcache.modules //这一步至关重要
#reboot
二、 bcache的管理依赖用户态程序bcache-tools,需要先编译打rpm包
1.获取源码:
git clone https://github.com/g2p/bcache-tools.git
2.打包
yum install uuid-devel openssl libblkid-devel udev
根据Makefile自己写一个bcache-tools.spec
rpmbuild -ba bcache-tools.spec
三、 ############### 在CentOS7上进行安装 ##################
1.在CentOS7.3及以下版本,先升级内核版本到3.10.0-693,CentOS7.4无需升级
rpm -Uvh kernel*
2.安装bcache内核模块并启动加载
cp bcache.ko.xz /usr/lib/modules/3.10.0-693.el7.x86_64/kernel/drivers/md/
echo "#!/bin/sh" > /etc/sysconfig/modules/bcache.modules
echo "/sbin/depmod -A" >> /etc/sysconfig/modules/bcache.modules
echo "/sbin/modprobe -f bcache" >> /etc/sysconfig/modules/bcache.modules
chmod 755 /etc/sysconfig/modules/bcache.modules
3.安装bcache-tools,rpm由上面的步骤打包产生
rpm -ivh bcache-tools-1.0.8-1.el7.x86_64.rpm
4. reboot