From 44a6927379cd7b674f9d06e7fe28fc7cdfb3366d Mon Sep 17 00:00:00 2001 From: Mechiel Lukkien Date: Thu, 9 May 2024 14:25:24 +0200 Subject: [PATCH] add hint about systemd ReadWritePaths if hardlinking fails on linux due to cross-device link may help admin figure out more easily how to work around this. for issue #170 by rdelaage --- backup.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/backup.go b/backup.go index 9695101..9d7bfdd 100644 --- a/backup.go +++ b/backup.go @@ -10,7 +10,9 @@ import ( "log/slog" "os" "path/filepath" + "runtime" "strings" + "syscall" "time" "github.com/mjl-/bstore" @@ -234,7 +236,11 @@ func backupctl(ctx context.Context, ctl *ctl) { // No point in trying with regular copy, we would warn twice. return false, err } else if !warnedHardlink { - xwarnx("creating hardlink to message failed, will be doing regular file copies and not warn again", err, slog.String("srcpath", srcpath), slog.String("dstpath", dstpath)) + var hardlinkHint string + if runtime.GOOS == "linux" && errors.Is(err, syscall.EXDEV) { + hardlinkHint = " (hint: if running under systemd, ReadWritePaths in mox.service may cause multiple mountpoints; consider merging paths into a single parent directory to prevent cross-device/mountpoint hardlinks)" + } + xwarnx("creating hardlink to message failed, will be doing regular file copies and not warn again"+hardlinkHint, err, slog.String("srcpath", srcpath), slog.String("dstpath", dstpath)) warnedHardlink = true }