Skip to content

Instantly share code, notes, and snippets.

@Enzime
Created October 12, 2015 14:51
Show Gist options
  • Save Enzime/ae35ee30c3f4d3ac42c4 to your computer and use it in GitHub Desktop.
Save Enzime/ae35ee30c3f4d3ac42c4 to your computer and use it in GitHub Desktop.
Hacky solution to use systemd-automount to always mount an external HDD
SUBSYSTEM=="block", ENV{ID_FS_UUID}=="548C310362B58070", ACTION=="add", SYMLINK+="ext", RUN+="/bin/systemctl daemon-reload", RUN += "/bin/systemctl start mnt-ex.automount"
SUBSYSTEM=="block", ENV{ID_FS_UUID}=="548C310362B58070", ACTION=="remove", RUN+="/bin/systemctl stop mnt-ex.automount"
UUID=548C310362B58070 /mnt/ex ntfs rw,uid=1000,gid=1000,dmask=027,fmask=137,nofail,x-systemd.device-timeout=1,x-systemd.automount,noauto 0 0
[Unit]
Description=Fix mnt-ex.automount hanging on startup
After=local-fs.target
[Service]
ExecStart=/bin/bash -c "[ ! -b /dev/ext ] && systemctl stop mnt-ex.automount"
[Install]
WantedBy=local-fs.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment