This explains how to setup openzfs on an ubuntu system. My system has an iqstor 15 drive array on it, and that is what I will be using in this example.
- apt-get install python-software-properties
- add-apt-repository ppa:zfs-native/stable
- apt-get update
- apt-get install ubuntu-zfs
- zpool create -f -o ashift=12 tank raidz \
ata-ST4000DM000-1111 ata-ST40000DM000-2222 ata-ST40000DM000-3333
NAS Build:
zpool create -f -o ashift=12 tank raidz2 \
SLC SLOG drive
unit MiB
mkpart zfs 1 16385
mkpart zfs 16285 122104
quit
zpool add tank log mirror <part1> <part2> <part3> (SLOG)
zpool add tank cache (L2ARC)
Filesystems are called datasets:
They all share the storage pool equally
zfs get compressionratio tank
zfs create tank/databases
zfs set compression=lz4 tank/databases
zfs create tank/databases -o compression=lz4
Snapshots:
zfs snapshot tank/databases@friday (start a snapshot)
apt-get install zfs-auto-snapshot (create snapshots on time intervals)
zfs set com.zun:auto-snapshot=true tank/databases
zfs set snapdir=visible tank/databases
Why create multiple file systems/datasets?
zpool scrub tank (check for errors)
zpool scrub cancel (kill scrubbing)
zpool iostat -v 1
zpool replace -f tank <disk1> <disk2> (old drive – new drive)
zpool status (will show the status of resilving)
Z 3,5,9,17,33
Z2 4,6,10,18,34
Z3 5,7,11,19,35
zpool status
zpool list
zpool iostat -v 1
zfs get compressionratio tank/databases
zdb (lists what zfs internal cache looks like)
zfs get all tank/databases (show all the paramters for a filesystem)
zfs list -t snapshot (show snapshots)
zfsonlinux.org
open-zfs.org/wiki/Main_Page
zfs set quota=10G tank/home/jeff
zfs get quota takn/home/jeff
zfs list -r tank/home
zpool create -f -o ashift=12 tank1 raidz2 \
pci-0000:0c:00.0-fc-0x520092b44d01bd04-lun-0 \
pci-0000:0c:00.0-fc-0x520092b4563e6e07-lun-0 \
pci-0000:0c:00.0-fc-0x520092b43a90080d-lun-0 \
pci-0000:0c:00.0-fc-0x520092b43a8c0a07-lun-0 \
pci-0000:0c:00.0-fc-0x520092b44d01bd10-lun-0 \
pci-0000:0c:00.0-fc-0x520092b43bd7ef01-lun-0 \
pci-0000:0c:00.0-fc-0x520092b49d716800-lun-0 \
pci-0000:0c:00.0-fc-0x520092b43a8c0a05-lun-0 \
pci-0000:0c:00.0-fc-0x520092b4353f2600-lun-0 \
pci-0000:0c:00.0-fc-0x520092b43a8c0a09-lun-0 \
pci-0000:0c:00.0-fc-0x520092b44d01bd06-lun-0 \
pci-0000:0c:00.0-fc-0x520092b44d01bd07-lun-0 \
pci-0000:0c:00.0-fc-0x520092b44d01bd0a-lun-0 \
pci-0000:0c:00.0-fc-0x520092b43a8c0a03-lun-0 \
pci-0000:0c:00.0-fc-0x520092b44d01bd1b-lun-0
zfs create tank/databases -o compression=lz4
–> replace disk with larger disk
zpool set autoexpand=on tank1
** pull a disk
** check logs for the drive that was removed
zpool detach tank old_1tb_drive
** insert new disk
zpoool replace -f old_1tb_drive new_2tb_drive
Mount on Boot:
You need to edit the file /etc/default/zfs
with your favourite editor, eg: nano, vim or something else, and change the lines
ZFS_MOUNT='no'
ZFS_UNMOUNT='no'
to
ZFS_MOUNT='yes'
ZFS_UNMOUNT='yes'
Automation tasks:
Reference here