[systemd-devel] How to automount

Paul D. DeRocco pderocco at ix.netcom.com
Sat Sep 19 02:05:52 PDT 2015


I want a removable flash drive to be automatically mounted when I plug it
in, and unmounted when I unplug it. I've done what seems to be required by
the systemd.automount man page, but it's not working.

The physical drive appears as /dev/sdb1 (it is a partitioned drive). The
mount point (which exists) is /media/ext. I created a media-ext.mount
file:

    [Mount]
    What=/dev/sdb1
    Where=/media/ext
    Options=noatime,exec,umask=0,sync,errors=continue

and a media-ext.automount file:

    [Automount]
    Where=/media/ext

Initially it doesn't work at all. If I manually restart
media-ext.automount, then it puts into the mount table:

    systemd-1 on /media/ext type autofs ...

but when I plug in the drive, nothing else happens. When I try to access
the drive, it just hangs until I hit ctrl-C.

I'm guessing that media-ext.automount should mount systemd-1 on startup,
and it should be automagically changed to /dev/sdb1 when I plug something
in. How do I get these two things to happen?

-- 

Ciao,               Paul D. DeRocco
Paul                mailto:pderocco at ix.netcom.com



More information about the systemd-devel mailing list