如何在CentOS7上加载网络块设备
How to load network block device on CentOS7
我正在尝试在我的 CentOS7 服务器上加载 nbd 网络块设备。但是,我得到了:
modprobe nbd
modprobe: FATAL: Module nbd not found.
如果有人能告诉我加载 nbd
模块的最佳方法,我将不胜感激。最后,我希望我可以通过 ansible 自动执行这些任务。
这是我的内核版本:
$ uname -r
3.10.0-327.28.3.el7.x86_64
谢谢!
我发现这很有用。如果这对您不起作用,请告诉我
uname -r
sudo su
# useradd builder
# groupadd builder
cd /home/centos
# Get Source Code, make sure you check the kernel version first and download the proper version
wget http://vault.centos.org/7.2.1511/updates/Source/SPackages/kernel-3.10.0-327.28.3.el7.src.rpm
rpm -ivh kernel-3.10.0-327.28.3.el7.src.rpm
# Build Preparation
mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros
cd ~/rpmbuild/SPECS
rpmbuild -bp --target=$(uname -m) kernel.spec
cd ~/rpmbuild/BUILD/kernel-3.10.0-327.28.3.el7/linux-3.10.0-327.28.3.el7.centos.x86_64/
# Build
make menuconfig
# Device Driver -> Block devices -> Set “M” On “Network block device support”
make prepare && make modules_prepare && make
make M=drivers/block -j8
modinfo drivers/block/nbd.ko
cp drivers/block/nbd.ko /lib/modules/3.10.0-327.28.3.el7.x86_64/extra/
depmod -a && sudo modprobe nbd
这将在 CentOS7 上启用 nbd
我正在尝试在我的 CentOS7 服务器上加载 nbd 网络块设备。但是,我得到了:
modprobe nbd
modprobe: FATAL: Module nbd not found.
如果有人能告诉我加载 nbd
模块的最佳方法,我将不胜感激。最后,我希望我可以通过 ansible 自动执行这些任务。
这是我的内核版本:
$ uname -r
3.10.0-327.28.3.el7.x86_64
谢谢!
我发现这很有用。如果这对您不起作用,请告诉我
uname -r
sudo su
# useradd builder
# groupadd builder
cd /home/centos
# Get Source Code, make sure you check the kernel version first and download the proper version
wget http://vault.centos.org/7.2.1511/updates/Source/SPackages/kernel-3.10.0-327.28.3.el7.src.rpm
rpm -ivh kernel-3.10.0-327.28.3.el7.src.rpm
# Build Preparation
mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros
cd ~/rpmbuild/SPECS
rpmbuild -bp --target=$(uname -m) kernel.spec
cd ~/rpmbuild/BUILD/kernel-3.10.0-327.28.3.el7/linux-3.10.0-327.28.3.el7.centos.x86_64/
# Build
make menuconfig
# Device Driver -> Block devices -> Set “M” On “Network block device support”
make prepare && make modules_prepare && make
make M=drivers/block -j8
modinfo drivers/block/nbd.ko
cp drivers/block/nbd.ko /lib/modules/3.10.0-327.28.3.el7.x86_64/extra/
depmod -a && sudo modprobe nbd
这将在 CentOS7 上启用 nbd