bsdua.org

/projects/hotplug-diskmount

Hotplug-diskmount is a plug-in to OpenBSD's hotplugd that automatically mounts removable disks to the filesystem. It works with any disk types (SD cards, USB mass storage devices, card readers and CD/DVD drives). This program is indended to be used in single user environment on desktop or laptop.

Before use

First of all, create directory where all mountpoints will be placed.

# /usr/local/libexec/hotplug-diskmount init

Enable hotplugd at boot time.

# echo "hotplugd_flags=" >> /etc/rc.conf.local

Add missing parts to your /etc/hotplug/attach. Remember to set executable bit to attach script if you are creating new one.

#!/bin/sh

DEVCLASS=$1
DEVNAME=$2

case $DEVCLASS in
2)
        /usr/local/libexec/hotplug-diskmount attach -u _LOGIN_ -m 700 "$DEVNAME"
        ;;
esac

What you get

When you plug USB thumb drive, insert SD card into the attached card reader or insert CD/DVD into attached removable DVD drive filesystems from these devices will be automatically mounted under /vol/DRIVE_NAME. Hotplug-diskmount will mount as many partitions as disk contains.
$ mount 
/dev/sd0i on /vol/CANON_SD32 type msdos (local, nodev, nosuid)
/dev/cd0a on /vol/5.0 Install CD type cd9660 (local, nodev, ...

$ ls /vol
5.0 Install CD  CANON_SD32

Download:

Public Mercurial Repository:

$ hg clone https://bitbucket.org/alex_vatchenko/hotplug-diskmount
Ukrainian OpenBSD User Group
Get Firefox

Copyright © 2006-2016, Alexey Vatchenko. All rights reserved.
Designed by Vladimir Mostovoy.