[systemd-devel] Automount behavior

Lennart Poettering lennart at poettering.net
Mon Jun 10 03:36:21 PDT 2013


On Sun, 09.06.13 19:59, Mickaël THOMAS (mickael9 at gmail.com) wrote:

> Hi,
> 
> I was trying to achieve automatic mounting of my external hard drive
> whenever it's plugged in.
> 
> I first tried the x-systemd.automount option in /etc/fstab but that
> led to problems when the disk is not plugged (KDE/GTK file dialogs
> hang indefinitely because they wait for the disk to be mounted).
> Setting x-systemd.device-timeout didn't seem to change anything.
> 
> I finally got it working by creating this data.target file and enabling it
> 
> [Unit]
> After=dev-disk-by\x5cx2dlabel-Data.device
> Conflicts=umount.target
> Before=umount.target
> Requires=data.mount
> 
> [Install]
> # I had to escape \x2d here
> WantedBy=dev-disk-by\x5cx2dlabel-Data.device
> 
> I still feel systemd should have this "mount on insert" feature
> integrated (and configurable from fstab). Also there should be a way
> for automount to behave in a non-blocking way (having it error out
> directly if the device is not there).

Passing "auto,nofail" should do that for you. (Since auto is the implied
default, just passing "nofail" suffices too). 

"nofail" will cause the device to be mounted at boot if it is there or
later on if it shows up.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list