ZFS

# ZFS filesystem install

on Centos 7.5

wget http://download.zfsonlinux.org/epel/zfs-release.el7_5.noarch.rpm

rpm -i zfs-release.el7_5.noarch.rpm

enable KMOD, disable DKMS

vim /etc/yum.repos.d/zfs.repo

disable DKMS, enable KMOD

[zfs]

name=ZFS on Linux for EL7 - dkms

baseurl=http://download.zfsonlinux.org/epel/7.7/$basearch/

enabled=0

metadata_expire=7d

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-zfsonlinux

[zfs-kmod]

name=ZFS on Linux for EL7 - kmod

baseurl=http://download.zfsonlinux.org/epel/7.7/kmod/$basearch/

enabled=1

metadata_expire=7d

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-zfsonlinux

install ZFS

yum install zfs

reboot host to pickup ZFS kernel module

once rebooted, check if module is loaded

modprobe zfs

lsmod | grep zfs

## Create ZFS pool

Move existing /home to another name

mv /home /home2

if proc is holding up the move, check whats active on /home

fuser -mv /home (install fuser , yum install psmisc)

get disk names of new disks

fdisk -l (should be something like /dev/sdb, /dev/sdc)

Create new ZFS home pool

zpool create home /dev/sdb /dev/sdc

## create RAID1 zpool

zpool create home mirror /dev/sdb /dev/sdc

check pool status

zpool list

to destroy pool

zpool destroy home

rename a pool

zpool rename home2 home

the new mount shows up

df -h

check status of zpool

zpool status -x

fix degraded pool

# detach faulty disk (zpool detach poolName diskName)

zpool detach home2 /dev/sdb

# replace physical broken disk (new disk shows up as /dev/sdb)

# only 1 of 2 drives is now part of the pool, drive /dev/sdc

# attach sdb to existing sdc

zpool attach home2 /dev/sdc /dev/sdb

## Take snapshot of FS

zfs snapshot home2@$timestamp

## Show snapshots

zfs list -t snapshot

## Restore from a snapshot

zfs rollback home2@$timestamp

## Create a Clone of a pool

## create another pool with specific mountpoint

zpool create home