Site Tools


Sidebar

Work

Projects Travel Singapore Socials (External)

projects:homelab:openzfs_notes

This is an old revision of the document!


OpenZFS Notes

Building OpenZFS on Fedora

  1. 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
  2. git clone https://github.com/openzfs/zfs.git --branch zfs-2.3.0-rc1 --single-branch --depth=1
  3. cd ./zfs
  4. ./autogen.sh
  5. ./configure
  6. make rpm rpm-dkms
  7. createrepo .
  8. cat << EOF | sudo tee /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
  9. 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.

  1. 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
  2. Verify ashift value of zpool(s):
    zdb -C | grep "ashift\| name:"
    Smallest possible IO = 2^ashift
    • 4096: ashift = 12
    • 512: ashift = 9
  3. 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)
  4. 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
  5. Verify command succeeded:
    zpool list -v && zdb -C | grep "ashift\| name:"
projects/homelab/openzfs_notes.1731087319.txt.gz · Last modified: 2024/11/08 17:35 by Andrew Yong


Warning: Trying to access array offset on null in /var/www/html/lib/plugins/gitbacked/action/editcommit.php on line 100

Warning: Trying to access array offset on null in /var/www/html/lib/plugins/gitbacked/action/editcommit.php on line 96