====== OpenZFS Notes ====== ===== Building OpenZFS on Fedora ===== - ''%%sudo dnf install --skip-broken gcc make autoconf automake libtool rpm-build libtirpc-devel libblkid-devel libuuid-devel libudev-devel openssl-devel zlib-devel libaio-devel libattr-devel elfutils-libelf-devel kernel-devel-$(uname -r) python3 python3-devel python3-setuptools python3-cffi libffi-devel git ncompress libcurl-devel python3-packaging dkms createrepo%%'' - ''%%git clone https://github.com/openzfs/zfs.git --branch zfs-2.3.0-rc1 --single-branch --depth=1%%'' - ''cd ./zfs'' - ''./autogen.sh'' - ''./configure'' - ''make rpm rpm-dkms'' - ''createrepo .'' - ''cat %%<<%% EOF | sudo tee -a /etc/yum.repos.d/zfs-local.repo\\ [zfs-local]\\ name=ZFS on Linux for Fedora $releasever Local\\ baseurl=%%file:///path/to/git/zfs%%\\ enabled=1\\ EOF'' - ''sudo dnf upgrade --refresh zfs zfs-dkms'' ===== Adding Hardware 512e SSDs to 512e/4kn zpool ===== If you're trying to add a (generally older or SATA) SSD to a zpool, you may come across this error: > ''$ sudo zpool add //tank// log mirror //ssd1 ssd2//'' > ''cannot add to '//tank//': adding devices with different physical sector sizes is not allowed'' This is because the existing zpool was created with 4k sector drives, causing ZFS to detect and set ashift = 12 (2^ashift = 4096), and new devices being added to the zpool must have consistent physical sector sizes. Below are some pre-checks that should be done before continuing to add the SSD(s), and how to override the newly detected inconsistent ashift value. - Verify physical sector size of your drives:\\ ''lsblk -do+LOG-SEC,PHY-SEC'' * 4kb sector drive with 512e enabled: LOG-SEC = 512, PHY-SEC = 4096 * 4kb sector drive without 512e enabled: LOG-SEC = 4096, PHY-SEC = 4096 * 4k/8k/16kb sector SSD with hardware 512e: LOG-SEC = 512, PHY-SEC = 512 * 512b drive: LOG-SEC = 512, PHY-SEC = 512 - Verify [[https://openzfs.github.io/openzfs-docs/Performance%20and%20Tuning/Workload%20Tuning.html#alignment-shift-ashift|ashift value]] of zpool(s):\\ ''zdb -C | grep "ashift\| name:"''\\ //Smallest possible IO = 2^ashift// * 4096: ashift = 12 * 512: ashift = 9 - Look at your SSD datasheet to confirm physical sector size ≥ 4096 (if you can't find this information, we will just have to assume it is a multiple of 4k) - Specify the same ashift value as the existing pool when adding the SSD(s):\\ ''sudo zpool add -o ashift=12 //tank// log mirror //ssd1 ssd2//'' - Verify command succeeded:\\ ''zpool list -v && zdb -C | grep "ashift\| name:"''