How to mount disk by UUID or LABEL in OS X El Capitan? I get the UUID and label of a disk from diskutil info disk0s4

diskutil info disk0s4
   Device Identifier:        disk0s4
   Device Node:              /dev/disk0s4
   Whole:                    No
   Part of Whole:            disk0
   Device / Media Name:      Untitled

   Volume Name:              Data

   Mounted:                  No

   File System Personality:  HFS+
   Type (Bundle):            hfs
   Name (User Visible):      Mac OS Extended
   Journal:                  Unknown (not mounted)
   Owners:                   Disabled

   Partition Type:           Apple_HFS
   OS Can Be Installed:      No
   Media Type:               Generic
   Protocol:                 PCI
   SMART Status:             Verified
   Volume UUID:              F8C88B2D-5412-343B-8969-254F3AC559B8
   Disk / Partition UUID:    1738336E-68DD-46B1-997E-57469CF0472D

   Total Size:               338.0 GB (337984569344 Bytes) (exactly 660126112 512-Byte-Units)
   Volume Free Space:        0 B (0 Bytes) (exactly 0 512-Byte-Units)
   Device Block Size:        512 Bytes

   Read-Only Media:          No
   Read-Only Volume:         Not applicable (not mounted)

   Device Location:          Internal
   Removable Media:          No

   Solid State:              Yes


mount using the volume label does not work:

$ sudo mount -t hfs LABEL=Data /Users/user/test
GetMasterBlock: Error 2 opening LABEL=Data
GetMasterBlock: Error 2 opening LABEL=Data
mount_hfs: error on mount(): error = -1.
mount_hfs: No such file or directory


mount using the volume UUID does not work with or without quotes:

$ sudo mount -t hfs uuid=F8C88B2D-5412-343B-8969-254F3AC559B8 /Users/user/test
GetMasterBlock: Error 2 opening uuid=F8C88B2D-5412-343B-8969-254F3AC559B8
GetMasterBlock: Error 2 opening uuid=F8C88B2D-5412-343B-8969-254F3AC559B8
mount_hfs: error on mount(): error = -1.
mount_hfs: No such file or directory
$ sudo mount -t hfs UUID="F8C88B2D-5412-343B-8969-254F3AC559B8" /Users/user/test
GetMasterBlock: Error 2 opening UUID=F8C88B2D-5412-343B-8969-254F3AC559B8
GetMasterBlock: Error 2 opening UUID=F8C88B2D-5412-343B-8969-254F3AC559B8
mount_hfs: error on mount(): error = -1.
mount_hfs: No such file or directory


mount using the volume identifier works

mymac:~ user$ sudo mount -t hfs /dev/disk0s4 /Users/user/test


Update:

My goal is to put the mount line in /etc/fstab as I want to mount a volume to a custom mountpoint.
When using OS X, it's usually more advisable to use diskutil for disk-related activities.

TL;DR:

To mount a volume/disk by identifier:

diskutil mount /dev/diskXsY          # mounts just that volume
diskutil mountDisk /dev/diskX        # mounts the whole disk


To mount a volume by UUID:

diskutil mount [Volume/Partition UUID]


To mount a volume by label:

diskutil mount [label]




Explanation

With diskutil, node identifiers (/dev/diskXsY) are interchangeable with UUIDs: in any diskutil operation (such as eject), a UUID can be specified instead of a node identifier. From the man page:


  DEVICES
  
  A device parameter to any of the above commands (except where
  explicitly required otherwise) can usually be any of the following:
  
  o   The disk identifier (see below).  Any entry of the form of disk*, e.g.  disk1s9.
  
  o   The device node entry containing the disk identifier.  Any entry of the form of /dev/disk*, e.g.  /dev/disk2.
  
  o   The volume mount point.  Any entry of the form of /Volumes/*, e.g.  /Volumes/Untitled.  In most cases, a "custom" mount
  point e.g.
                 /your/custom/mountpoint/here is also accepted.
  
  o   The URL form of any of the volume mount point forms described above.  E.g.  file:///Volumes/Untitled or file:///.
  
  o   A UUID.  Any entry of the form of e.g.  11111111-2222-3333-4444-555555555555.  The UUID can be a "media" UUID
  which IOKit places in an IOMedia node
                 as derived from e.g. a GPT map's partition UUID, or it can be an AppleRAID (or CoreStorage) set (LV) or member (PV) UUID.
  
  From man diskutil, section 'Devices'.




Obtaining these identifiers/UUIDs/labels are simple, with either of the following commands:

diskutil list                               # lists all connected volumes and their identifiers
diskutil info /dev/diskXsY | grep UUID      # gets the UUID of a connected volume


The returned values from these commands should look something like the following:

$ diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.3 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh SSD           499.4 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3

$ diskutil info /dev/diskXsY | grep UUID
Volume UUID:              1F340CD7-G071-4218-98DG-2D08G89CC57C
Disk / Partition UUID:    76E7G531-G6C3-5E37-C11B-BCEEC67D12G4


As shown above, the identifier can be found from the IDENTIFIER column, the label from the NAME column, and the UUID from either UUID field (either UUID will mount the volume).

By label:

$ diskutil mount Recovery\ HD
Volume Recovery HD on Recovery HD mounted


By UUID:

$ diskutil mount 67EG87EB-CB01-4ED9-082D-303F63CF6394
Volume Recovery HD on 67EG87EB-CB01-4ED9-082D-303F63CF6394 mounted


By disk identifier:

$ diskutil mount /dev/disk0s3
Volume Recovery HD on /dev/disk0s3 mounted


addition for edit to OP's question: mounting to a custom path

You can do this with diskutil mount and the -mountPoint option. From the man page:


  mount [readOnly] [-mountPoint path] device
  
  Mount a single volume.  If readOnly is specified, then the file system is mounted read-only, even if the volume's underlying file system and/or device and/or media supports writing; even the super-user may not write to it; this is the same as the rdonly option to mount (8).  If a -mountPoint is specified, then that path, rather than the standard path of /Volumes/VolumeName, will be used as the view into the volume file con- tent; a directory at that path must already exist.
  
  From man diskutil, section 'Verbs'.


The syntax to mount to a custom mountpoint is as follows:

diskutil mount -mountPoint /path/to/custom/mountpoint [volume (identifier/UUID/label)]


Bear in mind that /path/to/custom/mountpoint must be a directory, just like with mount, and that your identifier/UUID/label are specific to the volume (i.e. /dev/diskXsY not /dev/diskX). Mounting to a custom mountpoint cannot be done with diskutil mountDisk, and only works with a single volume at a time.