More final updates to ZFS article

master
kts of kettek (Tyger) 2018-08-08 21:41:29 -07:00
parent c6f98a2a70
commit 265497273e
1 changed files with 32 additions and 6 deletions

View File

@ -37,14 +37,40 @@ I began first by installing and setting it up on Arch Linux, following the guide
With this, the zpool *Lyon* was created, allowing me to copy over my home directory and begin using it by setting my entry in `/etc/passwd` to point to the appropriate Lyon zfs volume. I rebooted into Mac OS and issued the standard `sudo zpool import` and discovered that the Linux-made ZFS pool had setup an extended Linux-centric option that rendered it only able to mounted as read-only in Mac OS. This would not do, so I issued `sudo zpool destroy Lyon` and recreated it on Mac OS. With this in place, I switched back to Linux and confirmed that it had R/W access to the same pool. With this, the zpool *Lyon* was created, allowing me to copy over my home directory and begin using it by setting my entry in `/etc/passwd` to point to the appropriate Lyon zfs volume. I rebooted into Mac OS and issued the standard `sudo zpool import` and discovered that the Linux-made ZFS pool had setup an extended Linux-centric option that rendered it only able to mounted as read-only in Mac OS. This would not do, so I issued `sudo zpool destroy Lyon` and recreated it on Mac OS. With this in place, I switched back to Linux and confirmed that it had R/W access to the same pool.
Now it was merely a matter of synchronizing the UIDs and GUIDs for my user and group between the systems and setting them both up to use the appropriate user/home locations. With the zpool working and visible between both, I decided to set up a generic *Users* volume within the *Lyon* zpool in the event of adding additional volumes or otherwise. This was merely a matter of issuing `zfs create Lyon/Users`, moving the Mac OS partition's *Users* contents to it, and setting up the appropriate mount paths. I additionally enabled the *com.apple.mimic_hfs* setting in the event that I might run into problems otherwise: `sudo zfs set com.apple.mimic_hfs=on Lyon/Users`.
However, before I did this, I decided to set up a generic *Users* volume within the *Lyon* zpool in the event that I wish to add additional volumes or otherwise. This was merely a matter of issuing `zfs create Lyon/Users`, moving the Mac OS partition's *Users* contents to it, and setting up the appropriate mount paths. I additionally enabled the *com.apple.mimic_hfs* setting in the event that I might run into problems otherwise: `sudo zfs set com.apple.mimic_hfs=on Lyon/Users`. On Mac OS, I backed up the root */Users* directory, deleted the original, issued `zfs set mountpoint=/Users Lyon/Users`, then moved the original */Users/* contents into the mounted share.
On Mac OS, I backed up the root */Users* directory, deleted it, issued `zfs set mountpoint=/Users Lyon/Users`, then moved the original */Users/* contents into the mounted share. On Linux, I logged in as root, simply used the same */Users/* mount point and set my */etc/passwd* user entry to use */Users/kts*, as I do not know if it is possible to have a ZFS volume have different mount locations based upon the current host. Additionally, I modified my user entry in */etc/passwd* to use the same UID as used in Mac OS so there wouldn't be mismatched ownership. I additionally added a new group that matched Mac OS's *staff* GUID and made it my primary.
On Linux, I simply used the same */Users/* mount point and set my */etc/passwd* user entry to use */Users/kts*, as I do not know if it is possible to have a zfs volume have different mount locations based upon the current host. Additionally, I modified my user entry in */etc/passwd* to use the same UID as used in Mac OS so there wouldn't be mismatched ownership. I additionally added a new group that matched Mac OS's *staff* GUID and made it my primary. With all this in place -- and omitting some some minor mistakes along the way -- I safely rebooted back to Mac OS. However, upon attempting to login, it seemed the ZFS filesystem *Lyon/Users* was not automatically mounting on boot. To solve this -- and perhaps this is the wrong way to go about automounting ZFS -- I created two files responsible for mounting *Lyon/Users* on boot:
With all this in place -- and omitting some some minor mistakes along the way -- I safely rebooted between the two operating systems seamlessly, keeping my user changes and files shared and intact. **/usr/sbin/mount-Lyon**
#!/bin/bash
zfs mount Lyon/Users
**Shared ZFS on Mac OS & Linux was a success!** **/System/Library/LaunchDaemons/net.kettek.Lyon.plist**
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple$
<plist version="1.0">
<dict>
<key>Label</key>
<string>net.kettek.Lyon</string>
<key>ProgramArguments</key>
<array>
<string>/usr/sbin/mount-Lyon</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>UserName</key>
<string>root</string>
</dict>
</plist>
With these files in place, and with the appropriate root:wheel ownership set to both and the executable flag set on */usr/sbin/mount-Lyon*, I rebooted back to Linux, mounted the HFS+ boot as R/W, moved the old /Users to /Users2 (non-destructive move due to HFS+ driver spottiness), and rebooted back to Mac OS.
Lo and behold, I logged in as my user and saw that the ZFS filesystem *Lyon/Users* was mounted as */Users* and that my own user directory was appropriately loaded!
**Finally, shared ZFS on Mac OS & Linux was a success!**