• CentOS6编译装载nbd模块


    今天突然发现CentOS系统没有nbd模块,只能重新装下,下面记录下整个编译过程:

    系统:CentOS6.5

    内核:2.6.32-431.el6.x86_64

    [root@localhost ~]# yum install -y kernel-headers kernel-devel
    
    [root@localhost ~]# wget ftp://ftp.redhat.com/pub/redhat/linux/enterprise/6ComputeNode/en/os/SRPMS/kernel-2.6.32-431.el6.src.rpm
    
    [root@localhost ~]# rpm -ivh kernel-2.6.32-431.el6.src.rpm
    
    [root@localhost ~]# cd ~/rpmbuild/SOURCES/
    [root@localhost SOURCES]# tar jxf linux-2.6.32-431.el6.tar.bz2 -C /usr/src/kernels/ [root@localhost SOURCES]# cd /usr/src/kernels/
    [root@localhost kernels]# mv $(uname -r) $(uname -r)-old
    [root@localhost kernels]#
    mv linux-2.6.32-431.el6 $(uname -r) [root@localhost kernels]# cd $(uname -r)
    [root@localhost
    2.6.32-431.el6.x86_64]# make mrproper
    [root@localhost
    2.6.32-431.el6.x86_64]# cp ../$(uname -r)-old/Module.symvers . [root@localhost 2.6.32-431.el6.x86_64]# cp /boot/config-$(uname -r) ./.config
    [root@localhost
    2.6.32-431.el6.x86_64]# make oldconfig
    [root@localhost
    2.6.32-431.el6.x86_64]# make prepare
    [root@localhost
    2.6.32-431.el6.x86_64]# make scripts
    [root@localhost
    2.6.32-431.el6.x86_64]# make CONFIG_BLK_DEV_NBD=m M=drivers/block [root@localhost 2.6.32-431.el6.x86_64]# cp drivers/block/nbd.ko /lib/modules/$(uname -r)/kernel/drivers/block/
    [root@localhost 2.6.32-431.el6.x86_64]# depmod -a

    至此,nbd模块已经成功编译。

    下面加载nbd模块并查看成功装载后的情况:

    [root@localhost image]# modprobe nbd max_part=8
    [root@localhost image]# ll /dev/nbd*
    brw-rw---- 1 root disk 43,   0 Nov 20 21:24 /dev/nbd0
    brw-rw---- 1 root disk 43,  16 Nov 20 21:24 /dev/nbd1
    brw-rw---- 1 root disk 43, 160 Nov 20 21:24 /dev/nbd10
    brw-rw---- 1 root disk 43, 176 Nov 20 21:24 /dev/nbd11
    brw-rw---- 1 root disk 43, 192 Nov 20 21:24 /dev/nbd12
    brw-rw---- 1 root disk 43, 208 Nov 20 21:24 /dev/nbd13
    brw-rw---- 1 root disk 43, 224 Nov 20 21:24 /dev/nbd14
    brw-rw---- 1 root disk 43, 240 Nov 20 21:24 /dev/nbd15
    brw-rw---- 1 root disk 43,  32 Nov 20 21:24 /dev/nbd2
    brw-rw---- 1 root disk 43,  48 Nov 20 21:24 /dev/nbd3
    brw-rw---- 1 root disk 43,  64 Nov 20 21:24 /dev/nbd4
    brw-rw---- 1 root disk 43,  80 Nov 20 21:24 /dev/nbd5
    brw-rw---- 1 root disk 43,  96 Nov 20 21:24 /dev/nbd6
    brw-rw---- 1 root disk 43, 112 Nov 20 21:24 /dev/nbd7
    brw-rw---- 1 root disk 43, 128 Nov 20 21:24 /dev/nbd8
    brw-rw---- 1 root disk 43, 144 Nov 20 21:24 /dev/nbd9
    [root@localhost image]# 

    -------------------------
    No pains, no gains
  • 相关阅读:
    [好好学习]在VMware中安装Oracle Enterprise Linux (v5.7)
    [冲昏头脑]IDEA中的maven项目中学习log4j的日志操作
    [烧脑时刻]EL表达式1分钟完事
    Sublime2 破解教程
    全脑瘫IT时代(八)
    全脑瘫IT时代(九)
    迁移完成
    USB Debug Cable (一)
    一个不是很常见的.Net Interop问题
    全脑瘫IT时代(十二)
  • 原文地址:https://www.cnblogs.com/CasonChan/p/4111547.html
Copyright © 2020-2023  润新知