Site Tools


Sidebar

Work

Projects Travel Singapore Socials (External)

projects:homelab:openzfs_notes

This is an old revision of the document!


OpenZFS Notes

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.1728198328.txt.gz · Last modified: 2024/10/06 07:05 by Andrew Yong