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.
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.
case $DEVCLASS in
/usr/local/libexec/hotplug-diskmount attach -u _LOGIN_ -m 700 "$DEVNAME"
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
will mount as many partitions as disk contains.
/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
- hotplug-diskmount-0.8.tar.gz - (08 march 2013) - Several disks with the same name which are plugged at the same time are mounted on different mountpoints now.
- hotplug-diskmount-0.7.tar.gz - (18 december 2011) - Fsck(8) support is added. By default, hotplug-diskmount will run fsck(8) for a filesystem before mounting it. Option "-f" allows user to disable it or to run fsck(8) on a dirty filesystem only.
- hotplug-diskmount-0.6.tar.gz - (25 november 2011) - New option "-r" allows user to mount readonly. It can be applied to all filesystems or to dirty ones.
- hotplug-diskmount-0.5.tar.gz - (13 june 2011) - Don't try to mount swap partition.
- hotplug-diskmount-0.4.tar.gz - (8 september 2010) - New option "-d" allows user to specify different location for mount points (default is /vol). New "init" command helps user to create directories for mount points. Minor bugs fixed.
- hotplug-diskmount-0.3.tar.gz - (12 april 2010) - Unmount volume on SIGTERM. If directory for mountpoint already exists and it's empty, reuse it. Both features are useful when you are rebooting OS with removable device plugged in.
- hotplug-diskmount-0.2.tar.gz - (11 march 2010)
Public Mercurial Repository:
$ hg clone https://bitbucket.org/alex_vatchenko/hotplug-diskmount