# Installing ZFS on Linux

# Installation

WIP

# See Also

https://docs.oracle.com/cd/E23824_01/html/821-1448/gavwn.html#scrolltoc

# Post-Installation Configuration

# Ensure zfs-import-scan.service is enabled

It is not ascertained why but this service could sometimes be left un-enabled. This meant that ZFS cannot mount your zpools at boot time. To ensure that ZFS can mount your pools and datasets, ensure that the following commands are ran.

sudo systemctl start zfs-import-scan.service
sudo systemctl enable zfs-import-scan.service

# Best Practices

# List disks

ls -lh /dev/disk/by-id/

# Creating a new zpool

zpool create \
    -m /mnt/tank \
    -o ashift=12 \
    tank \
    mirror \
        ata-ST3000DM001-9YN166_S1F0KDGY \
        ata-ST3000DM001-9YN166_S1F0JKRR \
    mirror \
        ata-ST3000DM001-9YN166_S1F0KBP8 \
        ata-ST3000DM001-9YN166_S1F0JTM1

NOTE: If you encounter EFI drive labels error, use the -f flag to bypass it

# Get status of zpool

zpool status tank
zpool get all tank
zfs get all tank

# Change options of zpool

zfs set \
    atime=off \
    compression=lz4 \
    tank

# Create zfs dataset

zfs create \
    -o atime=off \
    -o compression=lz4 \

    # Custom recordsize
    -o recordsize=4K \

    # Encrypted dataset
    -o encryption=on \
    -o keyformat=passphrase \
    -o keylocation=prompt \

    # ACLs
    -o aclinherit=passthrough \
    -o acltype=posixacl \
    -o xattr=sa \
    tank/dataset

# Create zvols

WIP

# Add SLOG

zpool add \
    tank \
    log mirror \
        ata-ST3000DM001-9YN166_S1F0KDGY \
        ata-ST3000DM001-9YN166_S1F0JKRR

# Add L2ARC

zpool add \
    tank \
    cache \
        ata-ST3000DM001-9YN166_S1F0KDGY

# To scrub pool

zpool scrub tank

# To import in future

zpool import -d /dev/disk/by-id tank

# ZFS Event Daemon

WIP

# ZFS SMART

sudo apt install smartmontools

WIP

# See Also

http://open-zfs.org/wiki/Performance_tuning https://www.svennd.be/tuning-of-zfs-module/ https://jrs-s.net/category/open-source/zfs/

# References

https://github.com/zfsonlinux/zfs/wiki