Start Systemd Service After Device Appears: Difference between revisions

From JoBaPedia
Jump to navigation Jump to search
(Created page with "What if you install a service on a separate disk that is not necessarily mounted at boot? * Create fstab entries with nofail option /dev/dbvg/db2mspr /home/db2mspr...")
 
No edit summary
 
Line 1: Line 1:
What if you install a service on a separate disk that is not necessarily mounted at boot?
What if you install a service on a volume group located on a separate disk that is not necessarily mounted at boot?


* Create fstab entries with nofail option
* Create fstab entries with nofail option

Latest revision as of 19:28, 2 November 2020

What if you install a service on a volume group located on a separate disk that is not necessarily mounted at boot?

  • Create fstab entries with nofail option
/dev/dbvg/db2mspr      /home/db2mspr         xfs       nofail                   0  0
  • Create UDEV rule to activate the vg and mount the fs once the device appears
KERNEL=="devNameHere", RUN+="/bin/bash -c '/sbin/pvscan --cache -a ay && mount -a -O nofail'"
  • Add a require directive for the mount point to the service file
[Unit]
RequiresMountsFor=/home/db2mspr
...