[systemd-devel] Automount behavior

Mickaël THOMAS mickael9 at gmail.com
Sun Jun 9 10:59:15 PDT 2013


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).

Thanks.


More information about the systemd-devel mailing list