Ben's notes

Linux, Unix, network, radio...

User Tools

Site Tools


Network block device (nbd) - CentOS 7

  • Install prerequisites:
    yum groupinstall "development tools" 
    yum install kernel-devel kernel-headers ncurses-devel
    yum install xmlto asciidoc python-devel newt-devel perl pesign elfutils-devel audit-libs-devel perl-ExtUtils-Embed.noarch
  • Download and install the kernel source:
    cd /root
    yumdownloader --source kernel
    yum install kernel-3.10.0-229.4.2.el7.src.rpm
  • Prepare for building a binary RPM. Make sure you have enough space on the file system:
    cd /root/rpmbuild/SPECS/
    rpmbuild -bp kernel.spec
  • Configure the kernel module:
    cd /root/rpmbuild/BUILD/kernel-3.10.0-229.4.2.el7/linux-3.10.0-229.4.2.el7.centos.x86_64
    make menuconfig
  • Go to 'Device Drivers | Block devices' and set 'M' on 'Network block device support' exit saving new kernel config.
  • Compile time (get some coffee):
    make prepare && make modules_prepare -j4 && make -j4
  • Next build the block device modules:
    make M=drivers/block
  • Check the module:
    modinfo drivers/block/nbd.ko
  • If all looks good copy it to the running kernels extra folder in /lib/modules/$(uname -r)/extra.
  • Load the module:
    depmod -a && modprobe nbd
centos_7_nbd.txt · Last modified: 2021/10/09 15:14 by