Migrating from kmod-zfs to zfs-dkms on CentOS 7

Because of the bug with the kmod-zfs described here, I decided to migrate to zfs-dkms to test if it works.

I am starting with an old install like described in this guide.

First, I made a backup of the kernel:

[root@localhost ~]# ls /boot/
config-3.10.0-514.10.2.el7.x86_64
config-3.10.0-514.el7.x86_64
grub
grub2
initramfs-0-rescue-263ede4315d14b8ba4b3a93abc833aea.img
initramfs-3.10.0-514.10.2.el7.x86_64.img
initramfs-3.10.0-514.el7.x86_64.img
initrd-plymouth.img
symvers-3.10.0-514.10.2.el7.x86_64.gz
symvers-3.10.0-514.el7.x86_64.gz
System.map-3.10.0-514.10.2.el7.x86_64
System.map-3.10.0-514.el7.x86_64
vmlinuz-0-rescue-263ede4315d14b8ba4b3a93abc833aea
vmlinuz-3.10.0-514.10.2.el7.x86_64
vmlinuz-3.10.0-514.el7.x86_64
[root@localhost ~]# cd /boot/
[root@localhost boot]# cp vmlinuz-3.10.0-514.10.2.el7.x86_64 vmlinuz-3.10.0-514.10.2.bak1.el7.x86_64
[root@localhost boot]# cp initramfs-3.10.0-514.10.2.el7.x86_64.img initramfs-3.10.0-514.10.2.bak1.el7.x86_64.img
[root@localhost boot]# 
# yum install epel-release

# export ZPOOL_VDEV_NAME_PATH=YES

# mcedit /etc/yum.repos.d/zfs.repo 

[zfs]
...
enabled=1
...
[zfs-kmod]
...
enabled=0
...

# yum remove kmod-zfs kmod-spl

# yum install zfs zfs-dracut

[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-514.10.2.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-514.10.2.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-514.10.2.bak1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-514.10.2.bak1.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-514.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-514.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-263ede4315d14b8ba4b3a93abc833aea
Found initrd image: /boot/initramfs-0-rescue-263ede4315d14b8ba4b3a93abc833aea.img
done
[root@localhost ~]# 

# reboot

It boots only with the backup 3.10.0-514.10.2.bak1.el7.x86_64.

# yum clean
# yum update

"Could not resolve host: centos.uni-sofia.bg; Unknown error

[root@localhost ~]# cat /etc/resolv.conf
# Generated by NetworkManager
[root@localhost ~]# echo nameserver 8.8.8.8 >> /etc/resolv.conf 
[root@localhost ~]# echo nameserver 8.8.4.4 >> /etc/resolv.conf 
[root@localhost ~]# cat /etc/resolv.conf 
# Generated by NetworkManager
nameserver 8.8.8.8
nameserver 8.8.4.4
[root@localhost ~]# 

# yum update -y

[root@localhost ~]# find /lib/modules | grep zfs
/lib/modules/3.10.0-693.5.2.el7.x86_64/extra/zfs.ko
[root@localhost ~]# 


[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
/usr/sbin/grub2-probe: error: failed to get canonical path of `/dev/ata-VBOX_HARDDISK_VBf518d145-451b386d-part1'.


[root@localhost ~]# export ZPOOL_VDEV_NAME_PATH=YES
[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-693.5.2.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-693.5.2.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-514.10.2.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-514.10.2.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-514.10.2.bak1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-514.10.2.bak1.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-514.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-514.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-263ede4315d14b8ba4b3a93abc833aea
Found initrd image: /boot/initramfs-0-rescue-263ede4315d14b8ba4b3a93abc833aea.img
done
[root@localhost ~]# 

# reboot

It boots with 3.10.0-693.5.2.el7.x86_64, not booting with 3.10.0-514.10.2.el7.x86_64.

[root@localhost ~]# cat /proc/version 
Linux version 3.10.0-693.5.2.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) ) #1 SMP Fri Oct 20 20:32:50 UTC 2017
[root@localhost ~]# 


[root@localhost ~]# find /lib/modules | grep zfs
/lib/modules/3.10.0-693.5.2.el7.x86_64/extra/zfs.ko
[root@localhost ~]# 

Removing it because it does not work (zfs module missing):

# yum remove kernel-3.10.0-514.10.2.el7.x86_64

[root@localhost ~]# export ZPOOL_VDEV_NAME_PATH=YES
[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-693.5.2.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-693.5.2.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-514.10.2.bak1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-514.10.2.bak1.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-514.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-514.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-263ede4315d14b8ba4b3a93abc833aea
Found initrd image: /boot/initramfs-0-rescue-263ede4315d14b8ba4b3a93abc833aea.img
done
[root@localhost ~]# 


# reboot

Now it works:

[root@localhost ~]# cat /proc/version 
Linux version 3.10.0-693.5.2.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) ) #1 SMP Fri Oct 20 20:32:50 UTC 2017
[root@localhost ~]# 

[root@localhost ~]# rpm -qa | grep zfs
libzfs2-0.7.3-1.el7_3.x86_64
zfs-dkms-0.7.3-1.el7_3.noarch
zfs-release-1-4.el7_3.centos.noarch
zfs-0.7.3-1.el7_3.x86_64
zfs-dracut-0.7.3-1.el7_3.x86_64
[root@localhost ~]# 

Update: I was wrong

When updating your CentOS system with kmod-zfs, please update also your zfs.repo. I did not changed the version of the repo from 7.3 to 7.4.

Comments