How do I mount an usb drive on connect?

asked 2015-10-03 17:56:35 -0600

mightyflea gravatar image

Hi! I am running a fedora server (Fedora 22) and am looking for a way to automatically mount an usb drive when the drive gets plugged in.

I want to use this to do my backup. The idea is: When I connect the backup usb drive to the server, it gets mounted automatically and the backup program (obnam, probably) gets started to do the backup.

Now I know that gnome disks can set that up for me, but I do not want to install a GUI on a headless server unless it is absolutely necessary. I have looked into systemd's automount feature, but it does not do quite what I want: I want the drive to be mounted (and a program run) when the drive gets connected, not when the first access attempt is made.

Does anyone know how to do this?

edit retag flag offensive close merge delete


randomuser gravatar imagerandomuser ( 2015-10-04 10:53:31 -0600 )edit