MacOS Ventura - mounting local NFS share to root directory with help of synthetic.conf
1
vote
0
answers
347
views
I already figured a way, and it kinda works, but it just feels wrong. Is there a more proper way to do it?
I recently upgraded from Mojave to Ventura and suddenly realized I lost all my root folders, and I'm no longer able to create one. I dug through Q&A and found info about
/etc/synthetic.conf
- but it could easily create symlinks only, and I found out that typescript-eslint
for example cannot work with root symlinks, it needs real directory.
My later research resulted in either local NFS
share or macFUSE
bindfs
. I tried first, because it is already installed and seems easier. I had /work
and /data
directories and I moved them to /opt/work
and /opt/data
.
Created NFS share:
- /etc/exports
/opt/data /opt/work 127.0.0.1 ::1
- sudo launchctl start com.apple.rpcbind
- sudo nfsd enable
- sudo nfsd stop
- sudo nfsd start
Created empty mount points in root directory:
- /etc/synthetic.conf
data
work
Restarted, checked, mount points are created, and showmount -e
is ok.
Manual NFS mounting is ok too sudo mount -t nfs 127.0.0.1:/opt/data /data
, checked, sudo umount /data
Now I'm trying to mount these on startup.
### First
I tried /etc/fstab
- it is not mounted on restart, and sudo automount -cv
shows weird error automount: /data points to unexpected location /data, instead of /System/Volumes/Data/data
and it also creates symlink /System/Volumes/Data/data -> /opt/data
. Root /data
remains empty. Here is my part of /etc/fstab
127.0.0.1:/opt/data /data nfs rw,actimeo=1,hard,bg
127.0.0.1:/opt/work /work nfs rw,actimeo=1,hard,bg
### Second
I tried /etc/auto_master
. I got the same error as above, and after a lot of trial and error I came to this solution:
- my part of /etc/auto_master
/- /etc/auto_nfs
- /etc/auto_nfs
/System/Volumes/Data/../../../data -fstype=nfs,rw,actimeo=1,hard,bg 127.0.0.1:/opt/data
/System/Volumes/Data/../../../work -fstype=nfs,rw,actimeo=1,hard,bg 127.0.0.1:/opt/work
It works, persisted between reboots and sudo automount -cv
shows proper
automount: /System/Volumes/Data/home updated (/home -> /System/Volumes/Data/home)
automount: /data updated
automount: /work updated
automount: no unmounts
Is there a proper not hacky way to do this? Why it disallows to mount at root, and expects /System/Volumes/Data
? I found some info that you can do data /System/Volumes/Data/data
in /etc/synthetic.conf
and then mount NFS to /System/Volumes/Data/data
- but again - there will be symlink at root.
Asked by aousov
(141 rep)
Mar 20, 2024, 06:19 AM
Last activity: Mar 20, 2024, 12:09 PM
Last activity: Mar 20, 2024, 12:09 PM