managing external drive mount points

Discussion in 'macOS' started by TypeR389, Jan 4, 2006.

  1. TypeR389 macrumors member

    Apr 9, 2002
    Hi, I am trying to manage my multiple external firewire drives to not automount on the desktop when they are attached, but rather to force them to mount at an arbitrary folder location. I cannot seem to find a way to do this via the gui, can this be done by making some entries in my fstab file? I know how to do this on a linux machine, but is there a better way to do this in 10.4?
  2. belvdr macrumors 603

    Aug 15, 2005
    The problem with fstab is the device name, say if a device is connected later.

    Any volume is mounted under /Volumes. So why not create a symlink from your location to /Volumes/<volume_name>. It would have the same effect.
  3. mrichmon macrumors 6502a

    Jun 17, 2003
    You need to do two things:
    1. create an fstab entry, and
    2. set the automounter to run during system boot.

    Set up fstab
    The OS X fstab entry is almost identical to the linux fstab format. However, since you are talking about external drives then you need to use a unique identifier to identify the drive rather than the device id. The problem with using the device id (eg. /dev/disk2) is that any changes in the connected devices (adding or removing an external drive, adding a hub, etc) can change the order in which the devices are enumerated and thus changing the device id (eg. from /dev/disk2 to /dev/disk3 if you add a new drive).

    An OS X fstab should look like:
    #                                                               Fsck Pass Number
    #                                                                           |
    #                                                                Dump Flag  |
    #                                                                       |   |
    #                                                        Mount Options  |   |
    #                                                               |       |   |
    #                                                  Filesystem   |       |   |
    #                                                       |       |       |   |
    #                                         Mount Point   |       |       |   |
    #    Filesystem Identifer from diskutil         |       |       |       |   |
    #         |                                     |       |       |       |   |
    UUID=4236231D-1117-333F-8899-3235F9B8000E       none    hfs     rw,auto 1   2
    Where the fields in order are:
    1. first field is the unique device id,
    2. second field is the mount point. That is, where you want the device to mount such as /mounts/mydisk -- in this case "none" is specified with causes the drive to default to the /Volumes/<filesystem name> mount point,
    3. third field is the filesystem type,
    4. fourth field is the mount options,
    5. fifth field is the dump flag, and
    6. sixth field is the fsck pass number.

    To find the UUID for a particular drive you should open the terminal and run mount without any arguments to list the mounted filesystems and identify the device node for your external drive. The device node will be something like /dev/disk1s3. Ensure that the device you identify is for your external drive and not your internal drives. Now, using the device node you found, run the command diskutil info <device node> to obtain the UUID. For example, if your device node is /dev/disk1s3 then you run the command diskutil info /dev/disk1s3. In the list of information printed you will see a long UUID string. This is the UUID you need to use in your fstab file instead of the traditional device node entry.

    Setting up a /etc/fstab file will ensure that drives will mount with your specified options when they are automounted. But an additional step must be performed to ensure that the automounter mounts the drives when the system boots.

    Set automounter to run
    Under OS X by default, external drives are only mounted when a user logs into the system on the console. Other systems such as linux and Solaris typically mount drives during system boot. This means that if you ssh into OS X then your external drives will not be mounted until someone logs into the console.

    To change this default behavior you need to set a property on the system to ensure that the automounter runs when the system boots. To do so, open a terminal window and run the following command:

    sudo defaults write /Library/Preferences/SystemConfiguration/autodiskmount AutomountDisks
  4. belvdr macrumors 603

    Aug 15, 2005
    Man, OS X makes things too difficult sometimes.
  5. mrichmon macrumors 6502a

    Jun 17, 2003
    In reality the only difference in OS X compared to other Unix machines is the use of the UUID and that the automounter does not run at boot by default.

    My post was long because it took me a while to iron out how to control drive mounting under OS X for my MacMini home server. Once I got it working I wrote myself a howto so I didn't forget the details. I just cut and pasted most of the howto into the post above since I know those instructions work.
  6. belvdr macrumors 603

    Aug 15, 2005
    Yeah, and the UUID is the pain. Shame you can't just label the thing as you would do in HP-UX or Solaris, or even Linux. The reality is the UUID just gets in the way sometimes.
  7. mrichmon macrumors 6502a

    Jun 17, 2003
    How does the UUID get in the way? I'm not sure what you are referring to.

    In terms of just labeling the volume you sort of can do that. If you use the construct LABEL=MyDiskName instead of the UUID=SomeBigIdentifier then you can specify your fstab in terms of the volume name. Volume names can be changed using diskutil rename <device id> <name>. Not quite the same as labels in other systems but it gives you roughly the same behavior.
  8. belvdr macrumors 603

    Aug 15, 2005
    I mean that the UUID is so long and unrelated to the volume in question, in terms of a human. Thus, using a label makes it easier.
  9. TypeR389 thread starter macrumors member

    Apr 9, 2002

    this all makes sense, I knew how to add the fstab entries, but I was unaware that I needed to use the UUID field, which makes sense since I couldn't specify a volume name.

    I also didn't realize that volumes didn't get mounted until login, which explains some weird behavior when accessing these drives via samba. Sometimes I would get permission denied errors for what I thought was no appearent reason, then I would check the mac, and it would start working! the light brightens slowly ;)

Share This Page