Snorlax Ƶƶ( ̄▵—▵ ̄)

macOS OpenZFS

I happened to have a bunch of spare SSDs with me while also running out of space on my M.2 enclosure. So I had the idea of building a quad ssd enclosure DAS.

Most of the enclosures I can find uses the same chipset from ASMedia (ASM-2464PDX), I picked the 4M2 from OWC as it has built-in cooling fans and cheaper than Terramaster.

My specs:

Since macOS does not have native support for RAID 5 and I don’t want to pay for OWC’s softRAID, I decided to try OpenZFS.

Some history on ZFS and macOS (src):

Getting OpenZFS

Head to OpenZFS’s GitHub release and download the .pkg that supports your current OS. For example: OpenZFSonOsX-2.3.0-Sequoia-15-arm64.pkg

It’s gonna to install some daemons and a kernel extension so you will have to restart your mac. It’s nice I don’t need to worry about disabling SIP.

Configurations

Pool/Dataset Creation

  1. format all the drives:

    you don’t have to do this if it’s freshly installed

    diskutil eraseDisk free none /dev/diskX
    
  2. create zpool:

    Following the recommended pool creation command line here assuming my disks are disk4 - disk7:

    sudo zpool create -f -o ashift=12 \
    -O compression=lz4 \
    -O casesensitivity=insensitive \
    -O atime=off \
    -O normalization=formD \ 
    [pool] raidz1 /dev/disk4 /dev/disk5 /dev/disk6 /dev/disk7
    
  3. creating dataset (or see below for encrypted dataset):

    zfs create [dataset]
    
  4. change recordsize for datasets with big files, for example:

    sudo zfs set recordsize=1M mypool/photos
    
  5. enable autotrim:

    sudo zpool set autotrim=on [pool]
    
  6. mount/unmount dataset:

    sudo zfs unmount [dataset]
    

Dataset Encryption

  1. enable encryption for the zpool:

    sudo zpool set feature@encryption=enabled [pool]
    
  2. creating encrypted dataset

    sudo zfs create -o encryption=on -o keylocation=prompt -o keyformat=passphrase [dataset]
    
  3. to see the encryption status of the dataset:

    sudo zfs get encryption [dataset]
    
  4. to (un)load the key (so you get to enter it again next time before mounting):

    sudo zfs load-key -r [dataset]
    sudo zfs unload-key -r [dataset]
    

    and to check key status:

    sudo zfs get keystatus [dataset]
    

Maintenance

NO password on read/write

src

by default OpenZFS volumes can only be written by the root user, to give yourself read and write access so you don’t have to type your password every time:

MISC

#Fun #MacOS #OpenZFS