16

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?

3
  • Set an entry in: /etc/fstab Commented Jul 17, 2017 at 15:40
  • 1
    @user3439894 I already tried, as per the instructions here. However when I use the File System UUID which DiskUtility gives, an error occurs when opening the disk with sudo mount -a, namely GetMasterBlock: Error 2 opening UUID=5E75BA88-7C74-34A9-8CE6-266C752CE2CA GetMasterBlock: Error 2 opening UUID=5E75BA88-7C74-34A9-8CE6-266C752CE2CA mount_hfs: error on mount(): error = -1. mount_hfs: No such file or directory Commented Jul 17, 2017 at 15:56
  • Never mind, it turns out that mount -a just doesn't function as expected, and that setting the entry in /etc/fstab works fine if you mount the disk using DiskUtility Commented Jul 17, 2017 at 15:59

2 Answers 2

21

Set an entry in /etc/fstab as directed here - (edit: now available at archive.org). 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. Run sudo vifs to safely edit etc/fstab, and add the following line.

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

    or for APFS

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

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

Some notes:

  • 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.

11
  • 4
    I suggest that you read the man 5 fstab manual. The fifth field in the fstab entry is the instruction on whether you allow the filesystem to be dumped (crippled in macOS, 0 would be a better choice). The sixth field is used to determine the order in which fsck is run.
    – fd0
    Commented Jul 17, 2017 at 16:29
  • 8
    Editing of fstab is preferably done with sudo vifs!
    – klanomath
    Commented Jul 17, 2017 at 16:35
  • 1
    Had no joy with this but what did work for me was to write an Applescript where I pass the path using the hdiutil command. I then save as an Application and run on startup from my User setting in System Preferences. Syntax is: hdiutil mount -mountpoint /path/to/mountpoint <named.dmg> Commented Oct 4, 2018 at 13:13
  • 1
    @Seamus WebArchive to the rescue for the missing link in the opening sentence. See web.archive.org/web/20210506185521/http://hints.macworld.com/…
    – cgseller
    Commented Dec 12 at 18:26
  • 1
    @cgseller: Good find! I've made an edit to this post w/ your link.
    – Seamus
    Commented Dec 13 at 6:24
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.

2
  • 1
    In my case, after "Rename", I got "/Volumes/newname 1", I needed to do a remount. Unmount and mount, then it is "/Volumes/newname".
    – Haisea
    Commented Nov 4, 2021 at 15:11
  • 2
    The OP asked to change the mountpoint, not the mount name. This will change the name but it will still end up in /Volumes.
    – cgseller
    Commented Apr 15, 2022 at 18:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .