[systemd-devel] How to automount

Umut Tezduyar Lindskog umut at tezduyar.com
Mon Sep 21 06:59:36 PDT 2015


I am not sure if automount is really the right way to go. In the end,
your automount path will fail if your device is not plugged in.

You could always use udev rules (ENV{SYSTEMD_WANTS}='media-ext.mount')
to mount the volume.
http://www.freedesktop.org/software/systemd/man/systemd.device.html

Umut

On Sat, Sep 19, 2015 at 11:05 AM, Paul D. DeRocco
<pderocco at ix.netcom.com> wrote:
> 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
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel


More information about the systemd-devel mailing list