I have an external drive set up in my /etc/fstab
with noatime,nofail,x-systemd.device-timeout=500ms,x-systemd.automount,users
.
I also have several dependencies set up which only start when this drive is mounted. Here is a snippet of their .service
files:
[Unit]
Requires=home-pi-ssd.mount
After=network.target home-pi-ssd.mount
BindsTo=home-pi-ssd.mount
[Service]
Restart=always
[Install]
WantedBy=multi-user.target home-pi-ssd.mount
The problem is, the drive does not mount upon connection, but only when the drive is first accessed. The home-pi-ssd.mount
, and its dependent services, do not become Active
until I, say, ls ~/ssd
, after which they all start up as expected.
However, I really need these services to become active on connection, rather than having to manually trigger the automount trap. How can I make the mount happen immediately on connection rather than setting up a trap?
udev
rules. E.g., https://unix.stackexchange.com/questions/461700/how-to-mount-usb-drive-in-udev-rule – larsks Jun 08 '22 at 23:23udev
will solve this situation. Thank you! – Taylor Kline Jun 09 '22 at 14:27