Add NFS self-heal automation for immich/calibre/ocis, backed up in git

Stale NFS handles inside containers (ESTALE/errno -116) can persist even
after the host-side mount looks healthy, requiring a manual remount +
container restart. Adds systemd mount-ready hooks (BindsTo) to restart
immich_server/calibre/ocis when their NFS mount unit restarts, plus a
5-minute health-check timer that does a real nested read and force-remounts
on staleness. Host files backed up under system-config/nfs-self-heal/ so
they can be reinstalled after a host rebuild.
This commit is contained in:
2026-08-25 21:56:48 +00:00
parent d302060e4b
commit 42a31b6a44
8 changed files with 184 additions and 0 deletions
+20
View File
@@ -115,6 +115,26 @@ Summary of how each service connects to the unRAID NAS (192.168.1.192 / 192.168.
---
## Self-Healing (nas_family / nas_books / nas_owncloud)
As of 2026-08-25, stale-handle recovery for immich, calibre, and oCIS is
automated instead of requiring manual `systemctl restart` + `docker restart`:
- `<container>-mount-ready.service` (`immich-mount-ready`, `calibre-mount-ready`,
`ocis-mount-ready`) — `BindsTo=mnt-nas_*.mount`, restarts the container
whenever its mount unit restarts.
- `nfs-mount-heal.timer` (every 5 min) → `nfs-mount-heal.sh` — does a nested
file read (not just `ls` the mount root, which can succeed even when nested
handles are stale) against each of the three mounts. On failure it force-
remounts the mount unit, which cascades into the container restart above,
then sends a Telegram alert.
Host files backed up at `system-config/nfs-self-heal/` in this repo (see its
README for the reinstall procedure — these are systemd units, not
docker-compose, so they don't redeploy via Portainer).
---
## Recommended Migration (future)
Plex, qBittorrent, Immich, and Audiobookshelf all use the fragile Docker NFS named volume pattern. The safer pattern is systemd permanent mount + Docker bind mount (as used by calibre-import and oCIS). This would involve: