====ZFS install====
===Ubuntu===
On ubuntu based systems after 16.04 it's enough to run
apt install zfsutils-linux
for zfs support to be installed.
===Mint===
The same as Ubuntu.
===Centos7===
https://github.com/zfsonlinux/zfs/wiki/RHEL-and-CentOS
Add module to autoload by creating file ///etc/modules-load.d/zfs.conf// with content
zfs
====ZFS pools====
===Create a striped pool===
zpool create -o ashift=12 -m
===Create a mirror pool===
zpool create -o ashift=12 -m mirror
===Create a raidz pool===
* raidz/raidz1 - one drive can fail (requires 3+ drives)
* raidz2 - two drives can fail (requires 3+ drives)
* raidz3 - three drives can fail (requires 4+ drives)
zpool create -o ashift=12 -m raidz
===Add device to pool===
Please note you should match current pool type for accurate redundancy.
zpool add mirror|raidz(2,3)|none
===Get status on pool===
zpool status
===Delete pool===
zpool destroy
===List pools===
zpool list
===Rename pool===
This is a two step process. First the pool must be exported, then imported to a new name.
zpool export
zpool import
===Import pool===
Typically after re-installing the OS the datadrive (zfs) needs to be imported. Again this is a two step process.
zpool import
will list the zfs pools that it can find. Then it's just a matter of running
zpool import -f
to import the pool and mount the datasets.
Make sure to use by-id or similar for import as device naming (sd*) can change.
zpool import -f -d /dev/disk/by-id
====ZFS datasets====
or filesystems, as some call them
===Create dataset===
zfs create -o mountpoint= /
===Delete dataset===
zfs destroy /
===Set Quota===
zfs set quota=xxG /
====ZFS snapshots====
===Create a snapshot===
zfs snapshot -r /@
===List snapshots===
zfs list -t snapshot
===Rollback to snapshot===
zfs rollback /@
===Delete snapshot===
zfs destroy /@
===Delete all snapshots===
for snapshot in `zfs list -H -t snapshot -r |cut -f 1`; do zfs destroy $snapshot; done
====Troubleshooting====
===Cannot load zfs module===
ZFS installation problems on KDE Neon (16.04).
$ zpool status
The ZFS modules are not loaded.
Try running '/sbin/modprobe zfs' as root to load them.
$ /sbin/modprobe zfs
modprobe: ERROR: could not insert 'zfs': Unknown symbol in module, or unknown parameter (see dmesg)
It seems there is a problem on a fresh install of KDE Neon (16.04) where the kernel installed is not the same as the kernel headers. My only solution was to remove all zfs and kernel related packages and reinstall the following packages
linux-headers-generic
linux-image-generic
zfsutils-linux