DSBMC-Cli is a command-line client for DSBMD that provides a simple interface to query information about storage devices, and to send requests to mount, unmount and eject these. Furthermore, it can be used as automounter and autounmounter.

Current Version


Release Notes


FreeBSD® ports

The preferred way is to use the FreeBSD® ports if available:
# cd /usr/ports/sysutils/dsbmc-cli && make install distclean

Installation from source

# tar xf dsbmc-cli-0.4.tgz && cd dsbmc-cli-0.4 && make install
or check out the most recent code on GitHUB
# git clone https://github.com/mrclksr/dsbmc-cli.git
# git clone https://github.com/mrclksr/libdsbmc.git
# cd dsbmc-cli && make install


dsbmc-cli -L event command [arg ...] ; [-L ...]
dsbmc-cli -a [-b dev1,dev2,...][-U time] [[-L event command [arg ...]] ; [-L ...]]
dsbmc-cli {-a | -e | -m | -s | -u | -v speed} device
dsbmc-cli {-e | -u} <mount point>
dsbmc-cli -i <disk image>
dsbmc-cli -l
dsbmc-cli [-h]



Listen for event, and execute the command every time the event is received. Possible events are mount, unmount, add, and remove. The command must be terminated by a semicolon (;) as a separate argument. Each event provides information about the device that can be accessed using the placeholders %d (device name), %l (volume label), %m (mount point) (only mount and unmount), and %t (device type). A literal percent character (%) must be escaped by a further % character (%%). Possible values for the device type (%t) are hdd, usbdisk, datacd, audiocd, dvd, vcd, svcd, mmc, mtp, and ptp. The -L option can be given multiple times.


Auto-unmount. Try to unmount each automounted device every time seconds.


Automount. After mounting all devices presented by DSBMD, dsbmc-cli waits for new devices added to the system, and mounts them. In addition, the -L option can be specified for each event. If dsbmc-cli automounts a device, it executes the command defined for the mount event.

-b dev1,dev2,...

Define a comma-separated list of devices and/or volume labels to ignore if the -a option is given. Volume labels must be prefixed by volid=.
Example: dsbmc-cli -a -b da0p2,volid=EFISYS,volid=TMP

-e device, -e <mount point>

Eject the given device or the device mounted on <mount point>


List all currently attached devices DSBMD supports.

-i <disk image>

Create a memory disk to access the given disk image.

-m device

Mount the given device.

-s device

The storage capacity of the given device is queried, and the media size, the number of used and free bytes are printed to stdout.

-u device, -u <mount point>

Unmount the given device or the device mounted on <mount point>

-v speed device

Set the reading speed of the given CD/DVD device.


List available devices

$ dsbmc-cli -l

Listen for events, and execute commands

$ dsbmc-cli -L mount printf "%%s was mounted on %%s\n" %d %m ';' -L add echo "Device %d of type %t was added." ';'
Executes the command
printf "%%s was mounted on %%s\n" %d %m
if a device was mounted, and
echo "Device %d of type %t was added."
if a device was added. The placeholders %d, %m, and %t will be replaced by the device name, mount point, and the device/media type respectively. Note that a literal % must be escaped by a further percent character.

Mount a device

$ dsbmc-cli -m /dev/da0


Automounting is achieved by executing
dsbmc-cli -a
If you wish, add the command dsbmc-cli -a 2>/dev/null& to your shell's startup file, your display manager's startup file, or your ~/.xsession. If you don't want to manually unmount your devices, you can in addition use the -U flag:
dsbmc-cli -a -U 120
Besides automounting, this command will try to unmount automounted devices every 120 seconds, or 2 minutes. As long as files are being accessed on the device, unmounting will not happen.


Download DSBMC-Cli