HOTPLUG-DISKMOUNT(8)

NAME
hotplug-diskmount - disk auto-mounter for hotplugd

SYNOPSIS
hotplug-diskmount [-d dir] attach [-f never | dirty] [-F] [-g group] [-m mode] [-r all | dirty] [-u user] device
hotplug-diskmount [-d dir] init
hotplug-diskmount [-d dir] cleanup device

DESCRIPTION
The hotplug-diskmount command is usually started by hotplugd(8) from an attach script for disk drive (2) device class, and terminates when device is detached. It mounts as many partitions as the disk contains. hotplug-diskmount polls attached devices for media insertion or removal every 2 seconds. It is useful to detect and mount correctly disks inserted into card-readers and CD/DVD drives.

By default all mount points are created in the /vol directory, which should have been created beforehand by the init command. The default directory can be changed with the -d option.

The following commands and options are supported:

attach
    Instruct hotplug-diskmount to create a mount point for device and mount it there.

    -f never | dirty
        If never is specified hotplug-diskmount doesn't run fsck(8) on a file system. If dirty is specified hotplug-diskmount runs fsck(8) only if a file system is dirty. By default, hotplug-diskmount always runs fsck(8) before mounting a file system.

    -F  Disable FUSE for non-standard file systems. Currently NTFS is supported only.

    -g group
        Set mount point group to group. The default group is “wheel”.

    -m mode
        Set mount point permissions to mode. The default permissions are “0755”.

    -r all | dirty
        If all is specified hotplug-diskmount mounts all file systems readonly. If dirty is specified hotplug-diskmount mounts readonly dirty file systems only. By default, hotplug-diskmount mounts all file systems read-write.

    -u user
        Set mount point owner to user. The default user is “root”.

    Options -u, -g and -m are useful for the MSDOS file system.

    If fsck(8) is not disabled, it is started in preen mode with the “yes” option.

init
    Creates directory set for storing mount points and sets permissions on directories.

cleanup
    Instruct hotplug-diskmount to remove mount points for the device. This is necessary if hotplug-diskmount is terminated incorrectly.

FILES
/etc/hotplug/attach
    Script to execute on device attachment.

SIGNALS

SIGTERM
    causes hotplug-diskmount to unmount file system before removing the mount point. It's useful when hotplug-diskmount is killed during system shutdown. hotplug-diskmount never does force unmount.

EXAMPLES
Create directory set which will be used for storing mount points:

    /usr/local/libexec/hotplug-diskmount init

Sample attach script:

    #!/bin/sh
    DEVCLASS=$1
    DEVNAME=$2
    case $DEVCLASS in
    2)
    	/usr/local/libexec/hotplug-diskmount attach "$DEVNAME"
    	;;
    esac

SEE ALSO
fsck(8) hotplugd(8) mount(8)

AUTHORS
hotplug-diskmount was written by Alexey Vatchenko <av@bsdua.org>.

BUGS
If the user is fast enough it is possible that hotplug-diskmount will not detect media changing in a card-reader or CD/DVD drive. Also hotplug-diskmount being activated for CD/DVD drive can cause kernel to generate a lot of output on console, because hotplug-diskmount polls a device every 2 seconds.