Use USBmount to automatically mount USB drives on Ubuntu or Debian servers

If you want to automatically install a USB drive on a server running Debian or Ubuntu (including Raspbian or Raspbian Pi for Raspbian Pi), you can use a simple but very effective tool called USB interface.
USBmount is a set of scripts used to automatically mount USB mass storage devices when they are inserted. Although USBmount was not created to run only on the server, it is particularly useful on the server because it does not have a graphical user interface and it does not depend on any desktop environment. And most desktop computers can already mount USB devices automatically.
By default, USBmount uses the following command to automatically mount USB devices: /media/usb0, /media/usb1, …, /media/usb7 Mount point /media/usb0 As the first USB device plugged in, /media/usb1 Is the second USB device you plugged in, and so on.

For USB memory sticks with model name, a symbolic link will be created at /var/run/usbmount/MODELNAME As its mounting point.
The default USBmount configuration is set to automatically mount USB devices using the vfat, ext2, ext3, ext4, and hfsplus file systems. NTFS can be enabled after installing USBmount-by editing /etc/usbmount/usbmount.conf Profile and add ntfs fuseblk To FILESYSTEMS Variable (does not delete other file system types).
USBmount was removed from Debian not long ago because the version in the repository no longer works. It is still available in Ubuntu, but does not work properly in Ubuntu 18.04 and later. The bug has been fixed in USBmount git, so you can build your own updated USBmount package, which is available on Debian and Ubuntu (and on Raspbian / Ubuntu MATE for Raspberry Pi).
First install Git and download the latest version USBmount Git code:

sudo apt install git
git clone https://github.com/rbrito/usbmount

Next, install the packages needed to create the USBmount DEB package:

sudo apt install debhelper build-essential

Now all you have to do is navigate to the folder where you cloned the USBmount Git repository and build the DEB package:

cd usbmount
dpkg-buildpackage -us -uc -b

A DEB package should be created next to the usbmount folder. Install this package The USB mass storage device will be installed automatically after it is plugged in.

Source

Related Posts