Centos6.2编译NBD模块

时间:2022-07-17 02:14:14
编译 nbd 模块
yum install kernel-devel kernel-headers cd /tmp wget ftp://ftp.redhat.com/pub/redhat/linux/enterprise/6ComputeNode/en/os/SRPMS/kernel-2.6.32.220.4.2.el6.src.rpm (CentOS 6 其他版本的 kernel source rpm file 亦可在此下載) rpm -ivh kernel-2.6.32.220.4.2.el6.src.rpm cd ~/rpmbuild/SOURCES tar jxf linux-2.6.32-220.4.2.el6.tar.bz2 -C /usr/src/kernels/ cd /usr/src/kernels mv $(uname -r) $(uname -r)-old mv linux-2.6.32-220.4.2.el6 $(uname -r) cd $(uname -r) make mrproper cp ../$(uname -r)-old/Module.symvers . cp /boot/config-$(uname -r) ./.config make oldconfig make prepare make scripts make CONFIG_BLK_DEV_NBD=m M=drivers/block cp drivers/block/nbd.ko /lib/modules/$(uname -r)/kernel/drivers/block/ depmod -a
modprobe nbd 启用nbd模块
扩展nbd设备个数:http://www.spinics.net/lists/mm-commits/msg46091.html