Permanently change mount point of volume?

I'd like to set another user's home folder to use a certain volume on my disk. To that end, I'd like to be able to mount said volume at a specific location, say, at Users/foobar

I can do this using the command line by running sudo mount -t hfs /dev/disk0s4 /Users/, however this is only a temporary solution. If I unmount and remount the disk, it will mount to its usual location in Volumes/

Is there some way to permanently specify the mount point of a disk?


Solution 1:

Set an entry in /etc/fstab as directed here. To summarize.

  1. Open Disk Utility, unmount the relevant volume.

  2. Click on the volume you're trying to mount, and click the "info" button. Note down the drive's File System UUID, which should look something like 5E85BA88-7C74-34A9-8CE6-267C752CE2BA. I'm just gonna use 123abc as shorthand for it.

  3. Open up /etc/fstab using your text editor of choice (run it as root!) Edit: as per klanomath's comment below, run sudo vifs to safely edit etc/fstab, and add the following line.

    UUID=123abc /desired/mount/path hfs rw 0 2

  4. Mount the volume, the mount point should show the path you specified.

Some notes:

  • I have absolutely no clue what the "1 2" does at the end of that line. It was there in the link, so I kept it. Thanks to fd0 for helping me out here!

  • The page I linked instructs you to reload /etc/fstab using some niload command. I couldn't figure out how to install whatever package that required, but the good news is that I think DiskUtility will automatically reload the file, so don't worry about that.

  • Some sources will tell you to reload etc/fstab using the command mount -a. It seems like this should be a perfectly sensible way to do so, but it does not work. Don't worry if it tells you it can't mount a volume.

Solution 2:

In Disk Utility right tap on the APFS volume and click "Rename"

enter image description here

Now opening (mounting) the volume via Finder will mount it to /Volumes/home or whatever new name you give it.