[systemd-devel] Automount behavior

Mickaël THOMAS mickael9 at gmail.com
Sun Jun 16 13:32:10 PDT 2013


I've also found another issue regarding this (it's a small issue but still...)

Using "nofail" (and implied "auto") works as expected but if the
device is not there at boot time, systemd will try to mount it anyway
and fail after a certain timeout.
Problem is, if I happen to shutdown my machine before the timeout
ends, it will hang until the timeout has passed.
Ideally, I don't need systemd to try to mount the device if the disk
isn't there. Perhaps this could be the behavior when "nofail" option
is used.

What's your thoughts about this?

2013/6/10 Lennart Poettering <lennart at poettering.net>:
> 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