Moving home directory over to a ZFS dataset 2.1.6 Intel

All your general support questions for OpenZFS on OS X.

Re: Moving home directory over to a ZFS dataset 2.1.6 Intel

Postby lundman » Mon Dec 05, 2022 9:03 pm

You can certainly keep using ditto, just use it with "ditto --nopreserveHFSCompression" so that it doesn't try to put HFS compression on ZFS - you don't really want that anyway, you want ZFS to handle it (using whatever type you pick).
User avatar
lundman
 
Posts: 1335
Joined: Thu Mar 06, 2014 2:05 pm
Location: Tokyo, Japan

Re: Moving home directory over to a ZFS dataset 2.1.6 Intel

Postby Sharko » Tue Dec 06, 2022 10:01 pm

Hi, so the --nopreserveHFSCompression flag is working to allow me to copy the Library folder from the apfs volume to the ZFS dataset without errors. However... I still get the mystery error when trying to log in to the user account residing on the zfs dataset, with its completely unhelpful tag line "logging into the account failed because an error occurred." It seems like Monterey simply doesn't want to allow a home directory on a ZFS dataset! I've tried a couple of approaches, and none of them succeeded:

- I used the suggested ditto flag to graft the Monterey Library folder onto the Mojave-generated home directory on the zfs dataset
- renamed the Mojave dataset to 'temp' and then did a full 'rsync -a /Users/userkurt/ /Volumes/MICRON/HOME/Users/userkurt' . Still no joy, despite having no Mojave data involved - just a straight up copy of the working Monterey home directory, copied to a zfs dataset.

I double-checked that the com.apple.mimic property was set to apfs at both HOME and HOME/MICRON. The pool is set with case sensitivity off, and normalization set to formD.

Any ideas? Is there a particular log file that might explain why login is being rejected?

Thanks to any with insight.
Attachments
IMG_5053.jpg
IMG_5053.jpg (447.96 KiB) Viewed 2460 times
Sharko
 
Posts: 230
Joined: Thu May 12, 2016 12:19 pm

Re: Moving home directory over to a ZFS dataset 2.1.6 Intel

Postby Sharko » Tue Dec 06, 2022 10:26 pm

More (weirdness): I noticed that the topmost dataset (or pool name) of MICRON was not appearing in the Finder list of volumes, although HOME appeared in the list after I did 'mount -l MICRON/HOME' to unlock the native encryption on the dataset. So I did a simple 'zfs mount MICRON' and MICRON appeared in the Finder list. Thinking that this might have been the main problem, I tried to switch to userkurt with the menu bar 'person' icon. I got the spinning matchsticks for about ten seconds, and then it offered me accessibility options, sign into iCloud, etc. In a few minutes I was in a user session for userkurt, but... it wasn't a copy of the user data that was on the apfs volume: the dock was in the wrong place, and the programs that I set up previously (like Thunderbird) started up as though for the first time.

I quit that session and went back to the admin user. When I looked at the dataset on the zfs volume I saw that MacOS had erased or hidden all the 600+ GB of data that was formerly there!

Code: Select all
sh-3.2# cd /Volumes/MICRON/HOME/Users/
sh-3.2# ls
userkurt
sh-3.2# zfs list -r -t snapshot MICRON/HOME
NAME                                                 USED  AVAIL  REFER  MOUNTPOINT
MICRON/HOME@2022_08_21_user_data_Mojave              911M      -   625G  -
MICRON/HOME@zfs-auto-snap_monthly-2022-09-01-06h33   629M      -   626G  -
MICRON/HOME@zfs-auto-snap_monthly-2022-10-01-19h52  1.71G      -   630G  -
MICRON/HOME@2022_10_16_user_data_Mojave              771M      -   635G  -
MICRON/HOME@2022_10_30_user_data_Mojave              769M      -   636G  -
MICRON/HOME@2022_11_26_user_data_Mojave             1.98G      -   622G  -
MICRON/HOME@2022_11_30_user_data_Mojave_final        105M      -   624G  -
sh-3.2#


Formerly it looked like this:

Code: Select all
sh-3.2# pwd
/Volumes/MICRON/HOME/Users
sh-3.2# ls
.DS_Store   adminkurt   temp      userkurt
sh-3.2#

(note that the adminkurt in the listing immediately above is the adminkurt data from the Mojave dataset)

So, I feel like I've made two steps forward, and one step back. I guess I'll try a rollback and then start fresh with this new knowledge.
Sharko
 
Posts: 230
Joined: Thu May 12, 2016 12:19 pm

Re: Moving home directory over to a ZFS dataset 2.1.6 Intel

Postby Sharko » Tue Dec 06, 2022 10:34 pm

The rollback generated a hang, and I took a spindump. Here is the hopefully relevant bit:

Code: Select all
Process:          zfs [6080]
UUID:             14C4CD0E-698C-3E0E-9820-D32010165A72
Path:             /usr/local/zfs/bin/zfs
Codesigning ID:   org.openzfsonosx.zfs.zfs
Team ID:          735AM5QEU3
Shared Cache:     47E1DD7D-5E37-3EC3-A85C-901263EC66B5 slid base address 0x7ff8075f6000, slide 0x75f6000
Architecture:     x86_64
Parent:           bash [2052]
Responsible:      Terminal [1753]
UID:              0
Footprint:        1436 KB
Time Since Fork:  61s
Num samples:      999 (1-999)

  Thread 0x12cf0    DispatchQueue 140704353540312    999 samples (1-999)    priority 46 (base 31)
  999  start + 462 (dyld + 21806) [0x1133a452e]
    999  main + 530 (zfs + 10642) [0x10c289992]
      999  zfs_do_rollback + 496 (zfs + 19280) [0x10c28bb50]
        999  zfs_rollback + 480 (libzfs.4.dylib + 55520) [0x10c4518e0]
          999  lzc_rollback_to + 62 (libzfs_core.3.dylib + 22718) [0x10c3d58be]
            999  lzc_ioctl + 305 (libzfs_core.3.dylib + 17617) [0x10c3d44d1]
              999  lzc_ioctl_fd + 71 (libzfs_core.3.dylib + 26135) [0x10c3d6617]
                999  __ioctl + 10 (libsystem_kernel.dylib + 20166) [0x7ff8078ddec6]
                 *999  hndl_unix_scall64 + 22 (kernel + 57910) [0xffffff800021e236]
                   *999  unix_syscall64 + 507 (kernel + 7833867) [0xffffff800098890b]
                     *999  ioctl + 1229 (kernel + 6780397) [0xffffff80008875ed]
                       *999  ??? (kernel + 3397491) [0xffffff800054d773]
                         *999  VNOP_IOCTL + 331 (kernel + 3459435) [0xffffff800055c96b]
                           *999  spec_ioctl + 157 (kernel + 3509885) [0xffffff8000568e7d]
                             *999  zfsdev_ioctl + 104 (zfs + 1396264) [0xffffff7f9a529e28]
                               *999  zfsdev_ioctl_common + 1460 (zfs + 1131924) [0xffffff7f9a4e9594]
                                 *999  zfs_ioc_rollback + 214 (zfs + 1146134) [0xffffff7f9a4ecd16]
                                   *999  zfsvfs_teardown + 119 (zfs + 1411527) [0xffffff7f9a52d9c7]
                                     *999  vnode_iterate + 747 (kernel + 3196939) [0xffffff800051c80b]
                                       *999  ??? (kernel + 3198469) [0xffffff800051ce05]
                                         *999  ??? (kernel + 3199927) [0xffffff800051d3b7]
                                           *999  ??? (kernel + 3202417) [0xffffff800051dd71]
                                             *999  ubc_msync + 166 (kernel + 6867206) [0xffffff800089c906]
                                               *999  memory_object_lock_request + 268 (kernel + 1106908) [0xffffff800031e3dc]
                                                 *999  ??? (kernel + 1110468) [0xffffff800031f1c4]
                                                   *999  vnode_pager_data_return + 15 (kernel + 1053759) [0xffffff800031143f]
                                                     *999  vnode_pager_cluster_write + 263 (kernel + 1054631) [0xffffff80003117a7]
                                                       *999  vnode_pageout + 2056 (kernel + 7253384) [0xffffff80008fad88]
                                                         *999  VNOP_PAGEOUT + 109 (kernel + 3469917) [0xffffff800055f25d]
                                                           *999  zfs_vnop_pageoutv2 + 611 (zfs + 1462131) [0xffffff7f9a539f73]
                                                             *999  rrw_enter_read_impl + 115 (zfs + 688563) [0xffffff7f9a47d1b3]
                                                               *999  spl_cv_wait + 58 (zfs + 4298) [0xffffff7f9a3d60ca]
                                                                 *999  ??? (kernel + 6651116) [0xffffff8000867cec]
                                                                   *999  lck_mtx_sleep + 110 (kernel + 535566) [0xffffff8000292c0e]
                                                                     *999  thread_block_reason + 199 (kernel + 615815) [0xffffff80002a6587]
                                                                       *999  ??? (kernel + 624626) [0xffffff80002a87f2]
                                                                         *999  machine_switch_context + 219 (kernel + 1804795) [0xffffff80003c89fb]

  Binary Images:
           0x10c287000 -        0x10c2a6fff  zfs (0)                             <14C4CD0E-698C-3E0E-9820-D32010165A72>  /usr/local/zfs/bin/zfs
           0x10c3d0000 -        0x10c3dffff  libzfs_core.3.dylib (0)             <7D7223F6-76CD-3FB5-A561-862254A3D3CA>  /usr/local/zfs/lib/libzfs_core.3.dylib
           0x10c444000 -        0x10c4abfff  libzfs.4.dylib (0)                  <129C6AF0-8060-3282-86E3-13C89C98C04D>  /usr/local/zfs/lib/libzfs.4.dylib
           0x11339f000 -        0x113422fff  dyld (960)                          <7B87A986-A153-33C4-8470-D56410B7F9D5>  /usr/lib/dyld
        0x7ff8078d9000 -     0x7ff807910fff  libsystem_kernel.dylib (8020.240.7) <0EA0D8AC-C27B-3A71-A59B-EC3A6F116ACF>  /usr/lib/system/libsystem_kernel.dylib
   *0xffffff7f9a3d5000 - 0xffffff7f9a9f5fff  org.openzfsonosx.zfs 2.1.6 (2.1.6)  <31DC2C31-BEAB-3ED7-A2CF-8AA9F9D567E2>  /Library/StagedExtensions/Library/Extensions/zfs.kext/Contents/MacOS/zfs
   *0xffffff8000210000 - 0xffffff8000c0ffff  kernel (8020.240.7)                 <54B44BAE-1625-30CC-80B0-29E4966EFFDC>  /System/Library/Kernels/kernel


I tried to set the dataset to readonly first, as a defensive move, but got an error:

Code: Select all
sh-3.2# zfs set readonly=on MICRON/HOME
cannot mount 'MICRON/HOME': Invalid argument
property may be set but unable to remount filesystem
sh-3.2# zfs rollback MICRON/HOME@2022_11_30_user_data_Mojave_final
<hang>


TIme to hold down the power button and go to bed...
Sharko
 
Posts: 230
Joined: Thu May 12, 2016 12:19 pm

Re: Moving home directory over to a ZFS dataset 2.1.6 Intel

Postby Sharko » Wed Dec 14, 2022 12:53 pm

I just want to close out this thread by reporting success, sorta. I did rollback to my saved snapshot, then methodically went through the process of

1. Moving the old Mojave 'Library' folder to 'OldLibrary' in the user account copy of Mojave data on the zfs dataset.
2. Then ditto new Monterey 'Library' folder to the zfs dataset, being careful to use flag '--nopreserveHFSCompression"
3. Change the location of the user account in Users and Groups within System preferences to point to the user account on the zfs dataset.
4. Reboot so that the user account location change takes effect.
5. Mount the pool, MICRON. Side note: MICRON always seems to import on boot, but during the times when user account is pointing to the zfs dataset on boot MICRON doesn't mount. I have to type 'zfs mount MICRON' to get it to show up in the Finder.
6. Unlock and mount the encrypted dataset MICRON/HOME with 'zfs mount -l MICRON/HOME'.
7. LOG OUT of the admin account, then log into the user account in the zfs dataset.
8. Success.

I used the word 'sorta' up above. The qualification is based on this: in the past, when I've upgraded from one OS version to another prior to Mojave, all I had to worry about was the Library folder, since that was where Apple hid most of their changes. iTunes and Photos would just look in their respective folders and somehow latch onto the data, since the default locations and names for that data didn't change much from version to version. The change to Catalina and above saw iTunes split out into several different programs, and apparently you have to go through Migration Assistant to get everything hooked up properly when going from Mojave to Monterey. So I'm actually planning to re-do this whole process AGAIN, only this time using Migration Assistant to interface all the bits of the user account that Apple wants to connect up with. You can think of it like this: in the old way I grafted a modern Library folder onto a legacy collection of data; in the new approach I will graft the legacy data from Documents and Desktop and Downloads onto a user account that was prepared using Migration Assistant.
Sharko
 
Posts: 230
Joined: Thu May 12, 2016 12:19 pm

Re: Moving home directory over to a ZFS dataset 2.1.6 Intel

Postby lundman » Thu Dec 15, 2022 1:59 am

Thanks for the stack, that's exactly what I need, looks like a locking issue.
User avatar
lundman
 
Posts: 1335
Joined: Thu Mar 06, 2014 2:05 pm
Location: Tokyo, Japan

Re: Moving home directory over to a ZFS dataset 2.1.6 Intel

Postby Haravikk » Sun Dec 18, 2022 4:30 am

How are you actually relocating your user accounts? I've been running user accounts from ZFS datasets for a while now under v2.1.0, I tried v2.1.6 today but had to rollback due to performance issues (but I was able to login to the accounts).

In my case what I did is instead of trying to relocate the accounts, I mount the ZFS datasets over the default locations, so I have a dataset mounting at /Users/haravikk for that user account. It works fine, though it has the drawback that if you don't check the dataset is mounted before logging in, then macOS may create a new blank user account in that location.

Also, I ended up using com.apple.mimic=hfs rather =apfs, as =apfs didn't seem to actually do anything for me.

Before switching to ZFS I used to run my user accounts from a separate APFS volume (one for the system and administrator, one for all other users) using symlinks placed in /Users to redirect the home folders. This would encounter the same issue you describe if the users volume wasn't mounted, basically because the sym-link pointed somewhere that didn't exist.
Haravikk
 
Posts: 74
Joined: Tue Mar 17, 2015 4:52 am

Re: Moving home directory over to a ZFS dataset 2.1.6 Intel

Postby Sharko » Sun Dec 18, 2022 3:54 pm

Hi Haravikk, the whole method is outlined in my ridiculously long and detailed first post in this thread, but the short answer is that I set up a complete copy of the user account on the ZFS dataset, and then go into System Preferences > Users and Groups, right click on the user name, and this opens a window where you can point the OS at the user account (on the zfs dataset in this case).

Kurt
Sharko
 
Posts: 230
Joined: Thu May 12, 2016 12:19 pm

Previous

Return to General Help

Who is online

Users browsing this forum: No registered users and 31 guests