Skip to content

Commit

Permalink
add hint about systemd ReadWritePaths if hardlinking fails on linux d…
Browse files Browse the repository at this point in the history
…ue to cross-device link

may help admin figure out more easily how to work around this.

for issue #170 by rdelaage
  • Loading branch information
mjl- committed May 9, 2024
1 parent 4d28a02 commit 44a6927
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import (
"log/slog"
"os"
"path/filepath"
"runtime"
"strings"
"syscall"
"time"

"github.com/mjl-/bstore"
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 44a6927

Please sign in to comment.