[DRBD-user] Updating Kernel w/out Updating DRBD

Veit Wahlich cru.lists at zodia.de
Fri Jun 22 12:54:16 CEST 2018

Well, I assume you are on el7 here. Adapt to other distros if required.

1. Install dkms, for el7 it is available in EPEL:

# yum install dkms

2. Untar the drbd tarball in /usr/src/, for drbd 8.4.11-1, you should
now have a directory /usr/src/drbd-8.4.11-1/.

3. Create a file /usr/src/drbd-8.4.11-1/dkms.conf with this content:

MAKE="make -C drbd KDIR=/lib/modules/${kernelver}/build"
CLEAN="make -C drbd clean"

4. Register drbd with dkms, so dkms knows about it:

# dkms add -m drbd -v 8.4.11-1

5. Build the module of the desired version for the current kernel:

# dkms build -m drbd -v 8.4.11-1

6. Install the module of the desired version to the kernel's module

# dkms install -m drbd -v 8.4.11-1

You should now be able to use drbd.

dkms installs a hook that will automatically rebuild the module once you
install a new kernel{,-devel} package.
On rpm-based distros (maybe also others, I have not tested) and
depending on configuration, dkms also builds rpms for the new kmods, so
all files dkms writes are being registered with the package management.

If you want to remove a dkms installed module, you may simply use:

# dkms remove -m drbd -v 8.4.11-1 --all

--all removes the module from all kernel module trees.

Starting with drbd 9.0, the source tarball also includes an almost ready
to use dkms.conf file in the debian/ subdir. It is not specific to
Debian. May may want to copy it to .. and edit the module version
Please note that drbd 9.0 has 2 kernel module files (dkms.ko and
drbd_transport_tcp.ko) and the module source changed to src/drbd/, so
with drbd 9.0 use the the dkms.conf file provided with the tarball
instead of my example dkms.conf above.

Best regards,
// Veit

Am Freitag, den 22.06.2018, 08:43 +0000 schrieb Eric Robinson:
> I'm familiar with the --with-km switch when building drbd, but I don't see anything in the documentation that allows building an akmod or dkms version instead. How would I do that?
> Also, I find it odd that the option to build from source is only in the DRBD 8.3 User Guide and was left out of the 8.4 and 9.X User Guides. (I'm sure the reason is obvious to everyone else I just missed something.) 
> --Eric

More information about the drbd-user mailing list