Installing OpenZFS
Install the repository management system:
root@server:~# apt-get install -y software-properties-common
Enable contrib repositories:
root@server:~# apt-add-repository contrib
'contrib' distribution component enabled for all sources.
root@db2:~#
Upgrade system:
root@server:~# apt update
...
root@dserver:~# apt -y upgrade
Reboot system to boot with the new kernel:
root@server:~# reboot
Ssh back in to the host, and install the needed packages:
root@server:~# apt install -y linux-headers-$(uname -r) linux-image-amd64 spl kmod zfsutils-linux zfs-dkms zfs-zed
Say “OK” to imkompatability warning, and load the newly build kernel module:
root@server:~# modprobe zfs
Creating ZFS pools and datasets
Get a quick overview over the block devices in the system:
root@server:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda 254:0 0 160G 0 disk
├─vda1 254:1 0 59G 0 part /
├─vda2 254:2 0 100.9G 0 part
├─vda14 254:14 0 3M 0 part
└─vda15 254:15 0 124M 0 part /boot/efi
vdb 254:16 0 472K 1 disk
Creating the pool “storage”:
root@server:~# zpool create -f storage /dev/vda2
root@server:~# zpool list
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
storage 100G 129K 100G - - 0% 0% 1.00x ONLINE -
Create the dataset “mysql” in the “storage” pool:
root@server:~# zfs create storage/mysql
root@server:~# df -h |grep storage
storage 97G 128K 97G 1% /storage
storage/mysql 97G 128K 97G 1% /storage/mysql