HOTPLUG-DISKMOUNT(8)

NAME
hotplug-diskmount - disk auto-mounter for hotplugd

SYNOPSIS
hotplug-diskmount [-d dir] attach [-f never|dirty] [-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 attach script for disk drive (2) device class and terminates when the device is detached. It mounts as many partitions as disk contains. The hotplug-diskmount polls attached devices for media insert/removal every 2 seconds. It helps to detect and mount correctly disks inserted into card-readers and CD/DVD drives.

By default all mount points are created in /vol directory which should be created before by init command. Default directory can be changed by -d option.

The following commands and options are supported:

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

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

    -g group
        Set mount point group to group. By default, it's wheel.

    -m mode
        Set mount point mode bits to mode. By default, it's 0755.

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

    -u user
        Set mount point owner to user. By default, it's root.

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

    If fsck(8) is not disabled, it is started in preen mode with ``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. It's needed if hotplug-diskmount is terminated incorrectly.

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

SIGNALS

SIGTERM
    causes hotplug-diskmount to unmount filesystem before removing 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 user is fast enough it is possible that hotplug-diskmount will not detect media changing in 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. It's because hotplug-diskmount polls a device every 2 seconds.