How to install zfs on CentOS7
zfs centos linuxWARN: ZFS module does NOT with new kernel. File system xfs is better. Using lvm is a good option.
- Install epel-release and setup zfs repository.
sudo yum -y install epel-release
sudo yum localinstall --nogpgcheck http://archive.zfsonlinux.org/epel/zfs-release.el7.noarch.rpm
- update and reboot
sudo yum -y update
sudo shutdown -r now
- install kernel-dev zfs
$ sudo yum install kernel-devel zfs
$ sudo modprobe zfs
$ sudo lsmod |grep zfs
zfs 2713912 4
zunicode 331170 1 zfs
zavl 15236 1 zfs
zcommon 55411 1 zfs
znvpair 93227 2 zfs,zcommon
spl 92223 3 zfs,zcommon,znvpair
- create a zpool
$ ls /dev/vd*
/dev/vda /dev/vda1 /dev/vda2 /dev/vdb /dev/vdb1 /dev/vdb9
$ sudo zpool create -f <pool name> /dev/vdb
- add a new disk to zpool (This disk cannot be removed after add. Only spare disk can be removed)
$ ls /dev/vd*
/dev/vda /dev/vda1 /dev/vda2 /dev/vdb /dev/vdb1 /dev/vdb9 /dev/vdc
$ sudo zpool add<pool name> /dev/vdc
NOTE: if zpool cannot be mounted automatically after reboot, running the following command can fix it.
sudo systemctl preset zfs-import-cache zfs-import-scan zfs-mount zfs-share zfs-zed zfs.target
- Import existed pool.
\# show availabe zpool
$ sudo zpool import
\# import zpool
$ sudo zpool import <zpool id>
Written on November 5, 2016