bcache使用

bcache使用


bcache简介

Bcache is a Linux kernel block layer cache. It allows one or more fast disk drives such as flash-based solid state drives (SSDs) to act as a cache for one or more slower hard disk drives.
Bcache目前已被集成到Linux 3.10内核中,但是centos7默认是不支持bcache模块的。所以需要重新编译内核。

下载内核代码

As an ordinary user, not root, create a build tree based on a ~/rpmbuild/ directory:

[user@host]$ mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
[user@host]$ echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros

安装源码包和工具

[root@host]# yum install rpm-build redhat-rpm-config asciidoc hmaccalc perlExtUtils-Embed pesign xmlto
[root@host]# yum install audit-libs-devel binutils-devel elfutils-devel elfutils-libelfdevel
[root@host]# yum install ncurses-devel newt-devel numactl-devel pciutils-devel python-devel zlib-devel
[root@host]# yum install gcc net-tools bc bison

安装内核代码

[user@host]$ rpm -i http://vault.centos.org/7.2.1511/updates/Source/SPackages/kernel-3.10.0-514.10.2.el7.src.rpm 2>&1 | grep -v exist

到目前为止,源码包与工具包已经安装完毕,开始解压和准备源文件

[user@host]$ cd ~/rpmbuild/SPECS
[user@host SPECS]$ rpmbuild -bp --target=$(uname -m) kernel.spec

编译内核

需要安装kernel-devel,这时/usr/src/kernels就会生成内核源码
yum install kernel-devel(注意是否与系统版本一致)

make oldconfig
make menuconfig
go to "device drivers" -> "Multiple devices driver support (RAID and LVM)" -> "Block device as cache" enable it!
save and exit
make prepare
make scripts
拷贝Module.symvers
cp /usr/src/kernels/3.10.0-514.10.2.el7.x86_64/Module.symvers ./
make M=drivers/md/bcache

把驱动文件拷贝到系统默认加载路径下

cp drivers/md/bcache/bcache.ko /lib/modules/3.10.0-693.21.1.el7.x86_64/kernel/drivers/md/
生成模块间的依赖关系 depmod -a
加载模块 modprobe bcache

配置系统系统自动加载bcache模块

vi /etc/sysconfig/modules/bcache.modules
添加modprobe bcache
chmod +x /etc/sysconfig/modules/bcache.modules
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值