DartFS mount on Mac with Linux-style file paths

The default mount points for network shares on MacOS, when created by Finder. are below /Volumes/sharename.  This presents an obstacle to developing code on a Mac which needs to reference any absolute file paths (non-relative), and then run that code on the Linux cluster, where the network shares are mounted at /dartfs and /dartfs-hpc

MacOS can mount network shares in different locations, but there is problem with making them appear in the root directory (/dartfs/rc/....).  Since MacOS 10.15 (Catalina), the root directory is part of the readonly root volume, and you can't create folders there.  However, MacOS has a mechanism to create symbolic links in the root directory, which can be used to achieve the same effect.  (Reference: creating-root-level-directories-and-symbolic-links-on-macos-catalina/)

Step-by-step

  • Create (or edit, if it exists) the file /etc/synthetic.conf.  You need to do this as root, e.g. in Terminal:  sudo vi /etc/synthetic.conf or sudo open -a textedit /etc/synthetic.conf
  • Add the following lines.  You can use the # syntax to add whatever comments you want.  Replace USERNAME with your Mac user name. 
# SMB mount points to provide same paths as on Linux/NFS
dartfs /Users/USERNAME/dartfs
dartfs-hpc /Users/USERNAME/dartfs-hpc
  • Reboot.  This is needed to get new folder links, but you only need to do it once.

Your root directory will now have two symlinks.  In Finder they appear as aliases. In Terminal, ls -lwill show

lrwxr-xr-x   1 root  wheel    21 Oct 19 14:49 dartfs -> /Users/USERNAME/dartfs
lrwxr-xr-x   1 root  wheel    25 Oct 19 14:49 dartfs-hpc -> /Users/USERNAME/dartfs-hpc​​​​​​​

 

  • Next, we mount the top levels of DartFS into your Mac home directory (not the default Finder mount into /Volumes).    The Terminal commands are as follows. Replace the NETID in the authentication part with your own Dartmouth NetID.  You may be prompted for your NetID password.
  mount -t smbfs "//KIEWIT;NETID@dartfs.dartmouth.edu/rc" /dartfs/rc && open $HOMEdartfs

  mount -t smbfs "//KIEWIT;NETID@dartfs-hpc.dartmouth.edu/rc" /dartfs-hpc/rc && open $HOME/dartfs-hpc

Once completed, any references in code to, for example, /dartfs/rc/lab/M/Mylabshare will go to the same file as that references on Linux.  This applies to code in any language (e.g. Python, R, Stata).

 

The attached mount-dartfs.command clickable script assumes the /etc/synthetic.conf step has been done, and will perform the mounts and open two Finder windows for /dartfs/rc and /dartfs-hpc/rc.  If your Mac username is NOT your NetID, you should edit the file $HOME/.zshrc and add the line

export NETID=netid

replacing netid with your NetID.  This tells the mount-dartfs script which NetID to use.  You only need to do this once.

mount-dartfs tests for cached credentials, and if not found, it launches the Ticket Viewer app.  This Apple-supplied tool is not well documented.  A good description can be found at https://computing.help.inf.ed.ac.uk/kerberos-mac-os-x   An alternative is to run kinit $NETID@KIEWIT.DARTMOUTH.EDU in Terminal.

Print Article

Details

Article ID: 155314
Created
Wed 11/1/23 11:15 AM
Modified
Thu 3/14/24 12:55 PM