A modern automounter for removable media on PGSD/FreeBSD/GhostBSD.
- PGSD or FreeBSD 14.0+ or GhostBSD 25.01+
- libnotify
- Go 1.21 or later
# Clone the repository
git clone https://github.com/pgsdf/pgmount.git
cd pgmount
# Install dependencies
pkg install go gtk3 libnotify pkgconf
# Build (automatically downloads Go modules)
make
# Install
sudo make install# Coming soon: pkg install pgmountStart pgmountd as a daemon with automounting enabled:
pgmountdCommon options:
# Run with notifications and tray icon
pgmountd --notify --tray
# Run with auto-hiding tray icon
pgmountd --auto-tray
# Disable automounting
pgmountd --no-automount
# Use custom config file
pgmountd --config /path/to/config.yml
# Mount all devices on startup
pgmountd --mount-allTo start pgmountd automatically, add it to your window manager's autostart:
For Openbox (~/.config/openbox/autostart):
pgmountd --tray &For MATE (~/.config/autostart/pgmount.desktop):
[Desktop Entry]
Type=Application
Name=PGMount
Exec=pgmountd --tray
X-GNOME-Autostart-enabled=trueMount a specific device:
# Mount by device path
pgmount /dev/da0p1
# Mount with specific filesystem type
pgmount -t msdosfs /dev/da0p1
# Mount with options
pgmount -o nosuid,noexec /dev/da0p1
# Mount all available devices
pgmount -aUnmount a device:
# Unmount by device path
pgumount /dev/da0p1
# Unmount by mount point
pgumount /media/USB_DRIVE
# Unmount and detach (safe removal)
pgumount --detach /dev/da0p1
# Force unmount
pgumount -f /dev/da0p1
# Unmount all
pgumount -aList all removable devices:
# Basic list
pginfo
# Show all devices (including non-partitions)
pginfo -a
# Verbose output with details
pginfo -vPGMount uses a YAML configuration file located at ~/.config/pgmount/config.yml.
# Enable/disable automounting
automount: true
# Verbose logging
verbose: false
# Base directory for mount points
mount_base: /media
# File manager to open mounted directories
file_manager: xdg-open
# Notification settings
notifications:
enabled: true
timeout: 1.5 # Default timeout in seconds
device_mounted: 5.0 # Mount notification timeout
device_unmounted: -1 # -1 uses default timeout
device_added: -1
device_removed: -1
device_unlocked: 3.0
device_locked: -1
job_failed: 10.0 # Error notification timeout
# Tray icon settings
tray:
enabled: true
auto_hide: true # Auto-hide when no devices available
icon_name: drive-removable-media
# GELI encryption settings
geli:
enabled: true
password_cmd: "" # Custom password prompt command
cache_timeout: 0 # Password cache timeout (0 = disabled)
keyfiles:
# Map device UUID to keyfile path
"12345678-1234-1234-1234-123456789abc": "/path/to/keyfile"
# Per-device configuration
device_config:
# Configuration for specific device by UUID
- id_uuid: "ABCD-1234"
automount: false
ignore: false
options:
- noexec
- nosuid
# Configuration by label
- id_label: "MY_USB"
automount: true
options:
- locale=en_US.UTF-8
# Configuration by device path
- device_path: "/dev/da0p1"
ignore: true # Never mount this device
# Default mount options by filesystem type
mount_options:
default:
vfat:
- locale=en_US.UTF-8
- longnames
ntfs:
- locale=en_US.UTF-8
ext2: []
ext3: []
ext4: []
ufs: []
zfs: []
msdos:
- locale=en_US.UTF-8
- longnames
# Event hooks - execute commands on device events
event_hooks:
device_added: "echo 'Device {device} added' >> /tmp/pgmount.log"
device_mounted: "notify-send 'Mounted' '{label} mounted at {mount_point}'"
device_unmounted: "echo 'Unmounted {device}'"Event hooks support the following variables:
{device}- Device path (e.g.,/dev/da0p1){label}- Device label{uuid}- Device UUID{mount_point}- Mount point path
PGMount supports the following filesystems:
| Filesystem | FreeBSD Mount Type | Notes |
|---|---|---|
| FAT12/16/32 | msdosfs |
Full support |
| NTFS | ntfs |
Read-only by default, use ntfs-3g for write |
| ext2/3/4 | ext2fs |
Requires ext2fs kernel module |
| UFS | ufs |
Native FreeBSD filesystem |
| ZFS | zfs |
Native FreeBSD filesystem |
| exFAT | exfat |
Requires exfat-utils |
PGMount supports GELI-encrypted devices (FreeBSD equivalent of LUKS):
Devices will prompt for password when inserted:
# Daemon will automatically prompt
pgmountConfigure keyfiles in config.yml:
geli:
enabled: true
keyfiles:
"device-uuid": "/path/to/keyfile"# Unlock manually
geli attach -k /path/to/keyfile /dev/da0p1
# Then mount
pgmountd /dev/da0p1.eli-
Check if automounting is enabled:
pginfo -v
-
Verify device is not in ignore list (config.yml)
-
Check logs for errors:
pgmountd --verbose
Ensure your user is in the operator group:
sudo pw groupmod operator -m $USERThen log out and back in.
-
Ensure libnotify is installed:
pkg install libnotify
-
Test notifications:
notify-send "Test" "Testing notifications"
The tray icon requires GTK+3. Currently, the tray implementation is a stub. Full GTK integration is planned for future releases.
| Feature | udiskie (Linux) | pgmountd (FreeBSD) |
|---|---|---|
| Automounting | ✓ (udisks2) | ✓ (native FreeBSD) |
| Notifications | ✓ | ✓ |
| Tray Icon | ✓ | ⚠ (planned) |
| CLI Tools | ✓ | ✓ |
| Encryption | ✓ (LUKS) | ✓ (GELI) |
| Configuration | ✓ (YAML) | ✓ (YAML) |
| Event Hooks | ✓ | ✓ |
| Loop Devices | ✓ | ⚠ (planned) |
# Get dependencies
go mod download
# Run tests
go test ./...
# Build all binaries
make all
# Install
make installpgmount/
├── main.go # Main daemon
├── config/ # Configuration handling
│ └── config.go
├── device/ # Device detection and management
│ └── device.go
├── daemon/ # Automount daemon
│ └── daemon.go
├── notify/ # Desktop notifications
│ └── notify.go
├── tray/ # System tray icon
│ └── tray.go
└── cmd/ # Command-line utilities
├── pgmount/
├── pgumount/
└── pginfo/
BSD 2-Clause License
Copyright (c) 2025, Pacific Grove Software Distribution Foundation
Author: Vester (Vic) Thacker
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- Telegram: https://t.me/PGSD_Foundation
- Issues: https://github.com/pgsdf/pgmount/issues