Friday, July 31, 2020

Systemd automatically unmount filesystem mounted

A curious thing in RHEL7 (it has kind of a cache in the systemd for mounted FS)

To recreate the problemto i ha´d to change the LV linked to the FS /opt/MyfslogSD and /opt /MyfsWalComprSD after the changes in my the fstab file i re-mount the FS, but checking the log i realise that the systemd tries to unmount the FS over and over again until hours later, when there are no processes running inside.

Jul 2 14:54:17 Server1 systemd: Unit opt-MyfslogSD.mount is bound to inactive unit dev-vgdata-lvMyfslogSD.device. Stopping, too.
Jul 2 14:54:17 Server1 systemd: Unmounting /opt/MyfslogSD...
Jul 2 14:54:17 Server1 umount: (In some cases useful info about processes that use
Jul 2 14:54:17 Server1 umount: the device is found by lsof(8) or fuser(1))
Jul 2 14:54:17 Server1 systemd: opt-MyfslogSD.mount mount process exited, code=exited status=32
Jul 2 14:54:17 Server1 systemd: Failed unmounting /opt/MyfslogSD.
Jul 2 14:54:17 Server1 systemd: Unit opt-MyfslogSD.mount is bound to inactive unit dev-vgdata-lvMyfslogSD.device. Stopping, too.
Jul 2 14:54:17 Server1 systemd: Unmounting /opt/MyfslogSD...
Jul 2 14:54:17 Server1 umount: (In some cases useful info about processes that use
Jul 2 14:54:17 Server1 umount: the device is found by lsof(8) or fuser(1))
Jul 2 14:54:17 Server1 systemd: opt-MyfslogSD.mount mount process exited, code=exited status=32
Jul 2 14:54:17 Server1 systemd: Failed unmounting /opt/MyfslogSD.


[root@Server1 ~]# systemctl --all | grep opt-Postgres
opt-MyfsBackupSD.mount                        loaded    active   mounted   /opt/MyfsBackupSD
opt-MyfsDataSD.mount                          loaded    active   mounted   /opt/MyfsDataSD
opt-MyfsLogSD.mount                           loaded    active   mounted   /opt/MyfsLogSD
opt-MyfsScriptsSD.mount                       loaded    active   mounted   /opt/MyfsScriptsSD
opt-MyfsWalComprSD.mount                      loaded    inactive mounted   /opt/MyfsWalComprSD

opt-MyfslogSD.mount                           loaded    inactive mounted   /opt/MyfslogSD



After altering fstab one should either run systemctl daemon-reload (this makes systemd to reparse /etc/fstab and pick up the changes) or reboot.

[root@Server1 ~]# systemctl --all | grep opt-Postgres
opt-MyfsBackupSD.mount                        loaded    active   mounted   /opt/MyfsBackupSD
opt-MyfsDataSD.mount                          loaded    active   mounted   /opt/MyfsDataSD
opt-MyfsLogSD.mount                           loaded    active   mounted   /opt/MyfsLogSD
opt-MyfsScriptsSD.mount                       loaded    active   mounted   /opt/MyfsScriptsSD
opt-MyfsWalComprSD.mount                      loaded    active   mounted   /opt/MyfsWalComprSD