Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
21 lines (13 sloc) 684 Bytes

Automount USB drives with systemd

This is a dirty solution; but works. A good approach would be to use libudev.

On inserting an USB drive, automounts the drive at /media/ as a directory named by device label; just the device name if label is empty: /media/usbtest, /media/sdd

Tracks the list of mounted drives in /var/log/usb-mount.track.

Logs the actions in /var/log/messages with tag ''

Please do not expect it to perfectly handle all your needs. Be warned, minimally tested; okay for temporary plug-ins but certainly not recommended for enclosures with longer TTL.

To setup, run with sudo or as root; to undo the setup.

You can’t perform that action at this time.