Skip to content

Cannot backup JuiceFS PVCs using restic without root #1982

Description

@gjabell

Describe the bug

Similar to lost+found on ext4, PVCs managed by JuiceFS have special files (.accesslog, .config, .stats) that are always owned by root, which prevents non-root restic backups (and presumably rclone, etc.) from progressing.

Having to switch the mover to privileged just to work around this issue is non-ideal, especially since these files shouldn't be backed up in the first place.

Steps to reproduce

Expected behavior

These files are skipped in the same way lost+found is skipped on ext4 (#1033). Ideally a more generic solution (#959) would be supported that allows skipping arbitrary files without needing workarounds per-filesystem.

Actual results

Additional context

I've applied the following patch on my own image to work around this issue:

--- /mover-restic/entry.sh
+++ /mover-restic/entry.sh
@@ -80,7 +80,7 @@ function check_var_defined {

 function check_contents {
     echo "== Checking directory for content ==="
-    DIR_CONTENTS="$(ls -A "${DATA_DIR}" --ignore="lost+found")"
+    DIR_CONTENTS="$(ls -A "${DATA_DIR}" --ignore="lost+found" --ignore=".accesslog" --ignore=".config" --ignore=".stats")"
     if [ -z "${DIR_CONTENTS}" ]; then
         echo "== Directory is empty skipping backup ==="
         exit 0
@@ -154,7 +154,7 @@ function ensure_initialized {
 function do_backup {
     echo "=== Starting backup ==="
     pushd "${DATA_DIR}"
-    "${RESTIC[@]}" backup --host "${RESTIC_HOST}" --exclude='lost+found' .
+    "${RESTIC[@]}" backup --host "${RESTIC_HOST}" --exclude='lost+found' --exclude='.accesslog' --exclude='.config' --exclude='.stats' .
     popd
 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions