If you use the USB launcher service for device publishing, you can configure it to mount the filesystems of USB devices. That way, you don't need to use a separate service to mount filesystems (unless you also need to mount non-USB devices).
The USB launcher service can mount the filesystems of attached USB devices based on a mount-rules file. The service reads either the default mount-rules file, /etc/usblauncher/rules.mnt, or another file specified with the -M command-line option. The service uses the standard mount() function call to do the actual mounting.
The mount-rules file specifies one matching rule per line, with each rule containing fields for a device, mountpoint, filesystem type, and options. The service processes the rules starting from the first line and stopping at the first matching rule that either succeeds or tells the service to skip the device (i.e., when the rule has only a global pattern and no mount information). If a rule's execution fails, the service goes to the next rule (line), until it successfully executes a rule or reaches the end of the file. To select the appropriate filesystem, you can define multiple rules for a removable device.
# Device Mountpoint FS type Options /dev/umass[0-9]* / enum /dev/umass[0-9]*t1[1234] /fs/usb%0 dos /dev/umass[0-9]*t1[1234].* /fs/usb%0 dos /dev/umass[0-9]*t[146] /fs/usb%0 dos /dev/umass[0-9]*t[146].* /fs/usb%0 dos /dev/umass*t17[789] /fs/usb%0 qnx6 sync=optional /dev/umass[0-9]* /fs/usb%0 dos
Sequence | Description |
---|---|
%# |
Expands to the major device number of the storage device. For example, with /fs/usb%#, /dev/umass0 will be mounted at /fs/usb0 and /dev/umass1 will be mounted at /fs/usb1. But %# does not permit multiple partitions, so it's better to use %0. |
%U |
Expands to the filesystem UUID (universally-unique identifier) of the storage device. For example, with /fs/%U, the filesystem will be mounted at /fs/filesystem_uuid. If no valid filesystem UUID is found, the service replaces %U with uuid%0 to allocate a unique mountpoint name. Only supported for FAT and NTFS filesystems. |
%P |
Expands to the partition UUID of the storage device. If no valid partition UUID is found, the service replaces %P with uuid%0 to allocate a unique mountpoint name. For example, with /fs/%P, the filesystem will be mounted at /fs/partition_uuid. Only supported for MBR and GPT partitions. |
%0 |
Used principally to support multiple partition rules in the /etc/usblauncher/rules.mnt file, all with mountpoint names of the form /fs/usb%0. If you specify %0 in the name, the service tries to allocate /fs/usb0, /fs/usb1, and so on until it finds a unique mountpoint name. |
By default, the USB launcher service automatically attempts to mount filesystems on USB devices. To disable the auto-mounter feature, use the -M option to point to an empty mount-rules file or to /dev/null. If you use this technique, the service won't log mount attempts or publish accurate mnt_status values through the PPS mount object.