openzfsonosx / zfs

OpenZFS on OS X
https://openzfsonosx.org/
Other
824 stars 72 forks source link

Mount of encrypted dataset fails with I/O error between ZFS versions #787

Closed davidschlachter closed 3 years ago

davidschlachter commented 3 years ago

Mac system: Mojave with OpenZFS-2.0-release (from Nov 30, 2020 forum post) FreeBSD system: 13.0-BETA3 with system OpenZFS 2.0.0

I have a zpool that I have been sharing between FreeBSD and macOS (exporting between reboots), which includes an encrypted dataset. I recently updated from FreeBSD 12 to version 13, which replaces the ZFS implementation with OpenZFS. This caused the issue that I described in a comment on this FreeBSD bug. Briefly: the encrypted datasets could not be mounted on the new FreeBSD version.

However, now that I've recreated my pool, I see the same behaviour in macOS. I created the pool and datasets with FreeBSD 13. On macOS, unencrypted datasets in the pool mount without any problems. Attempting to mount the encrypted datasets (e.g. with zfs mount -lav) fails, causing a data error to appear for the pool in `zpool status -v'. However, a scrub will clear the error, but the dataset will still not mount. Comments on the FreeBSD bug suggest that this could be an incompatibility between earlier and more recent OpenZFS builds.

Please let me know if there's any other information I could provide.

davidschlachter commented 3 years ago

Example logs on macOS:

david@macbook ttys000 [0] /usr/obj
07:55:52 $ zpool status testpool
  pool: testpool
 state: ONLINE
status: Some supported features are not enabled on the pool. The pool can
    still be used, but some features are unavailable.
action: Enable all features using 'zpool upgrade'. Once this is done,
    the pool may no longer be accessible by software that does not support
    the features. See zpool-features(5) for details.
config:

    NAME                   STATE     READ WRITE CKSUM
    testpool               ONLINE       0     0     0
      /usr/obj/test-zpool  ONLINE       0     0     0

errors: No known data errors

david@macbook ttys000 [0] /usr/obj
07:57:39 $ sudo zfs mount -lv testpool/encrypted
Enter passphrase for 'testpool/encrypted':
do_mount calling mount with fstype zfs, rpath /Volumes/testpool/encrypted, fspec testpool/encrypted, mflag 0, optptr defaults,atime,strictatime,dev,exec,rw,setuid,nomand,zfsutil, optlen 60, devdisk 0, ispool 0
cannot mount 'testpool/encrypted': Unknown error: -1

david@macbook ttys000 [1] /usr/obj
07:57:49 $ sudo zpool status -v testpool
  pool: testpool
 state: ONLINE
status: One or more devices has experienced an error resulting in data
    corruption.  Applications may be affected.
action: Restore the file in question if possible.  Otherwise restore the
    entire pool from backup.
   see: https://openzfs.github.io/openzfs-docs/msg/ZFS-8000-8A
config:

    NAME                   STATE     READ WRITE CKSUM
    testpool               ONLINE       0     0     0
      /usr/obj/test-zpool  ONLINE       0     0     0

errors: Permanent errors have been detected in the following files:

        testpool/encrypted:<0x0>

david@macbook ttys000 [0] /usr/obj
07:58:33 $ sudo zpool scrub testpool

david@macbook ttys000 [0] /usr/obj
07:58:54 $ sudo zpool status -v testpool
  pool: testpool
 state: ONLINE
status: Some supported features are not enabled on the pool. The pool can
    still be used, but some features are unavailable.
action: Enable all features using 'zpool upgrade'. Once this is done,
    the pool may no longer be accessible by software that does not support
    the features. See zpool-features(5) for details.
  scan: scrub repaired 0B in 00:00:00 with 0 errors on Fri Feb 26 07:58:54 2021
config:

    NAME                   STATE     READ WRITE CKSUM
    testpool               ONLINE       0     0     0
      /usr/obj/test-zpool  ONLINE       0     0     0

errors: No known data errors
davidschlachter commented 3 years ago

Here's the file-backed zpool in the above example. The passphrase (prompt) is password for testpool/encrypted. I created the pool on FreeBSD and tested (above) on macOS.

test-zpool.zip

lundman commented 3 years ago

We've fixed a bunch of issues, and only just got to this one:

# ./scripts/cmd-macos.sh zfs mount -al
Enter passphrase for 'testpool/encrypted':
testpool/encrypted   95Mi  1.0Mi   94Mi     2%      75    192692    0%   /Volumes/testpool/encrypted
-rw-r--r--  1 root  wheel  26802 Feb 26 04:51 zfs-man-page

Since it works fine, I am hoping one of the other import fixes also corrected this problem. Please try again once I push out a new installer. (or compile your own).

davidschlachter commented 3 years ago

The problem is resolved in the zfs-2.0.0-rc1 build posted yesterday on the forums. Thank you so much!