默认情况下,CentOS7并没有含ZFS支持的文件和,需要进行更新和安装第三方库。
Step 1:安装第三方库和更新系统
[root@localhost ~]# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
[root@localhost ~]# rpm -Uvh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
[root@localhost ~]# rpm -Uvh https://forensics.cert.org/cert-forensics-tools-release-el7.rpm
[root@localhost ~]# rpm -Uvh http://download.zfsonlinux.org/epel/zfs-release.el7_6.noarch.rpm
[root@localhost ~]# yum update -y
[root@localhost ~]# yum groupinstall -y "Development Tools" "Development Libraries" "Additional Development"
[root@localhost ~]# yum install -y kernel-devel kernel-headers
Step 2:重启系统
Step 3:安装zfs,并且载入模块到内核
[root@localhost ~]# yum install -y zfs
[root@localhost ~]# /sbin/modprobe zfs
Step 4:建立池,本例采用镜像的方式
[root@localhost ~]# zpool create zfs mirror /dev/sdb /dev/sdc
[root@localhost ~]# zpool list
NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
zfs 119G 272K 119G - 0% 0% 1.00x ONLINE -
[root@localhost ~]#
Step 5:建立ZFS分区
[root@localhost ~]# zfs create -o quota=80G zfs/data
[root@localhost ~]# zfs list
NAME USED AVAIL REFER MOUNTPOINT
zfs 114K 115G 24K /zfs
zfs/data 24K 80.0G 24K /zfs/data
[root@localhost ~]#
Step 6:查看挂载
[root@localhost ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/mapper/centos-root 50G 3.7G 47G 8% /
devtmpfs 2.0G 0 2.0G 0% /dev
tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs 2.0G 12M 2.0G 1% /run
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/sda1 1014M 163M 852M 17% /boot
/dev/mapper/centos-home 66G 33M 66G 1% /home
tmpfs 394M 0 394M 0% /run/user/0
zfs 116G 0 116G 0% /zfs
zfs/data 80G 128K 80G 1% /zfs/data
[root@localhost ~]#