Skip to content

fix: container backup should not fail entirely on mount copy errors#12276

Open
jakub961241 wants to merge 1 commit into1Panel-dev:dev-v2from
jakub961241:fix/container-backup-mount-skip-12236
Open

fix: container backup should not fail entirely on mount copy errors#12276
jakub961241 wants to merge 1 commit into1Panel-dev:dev-v2from
jakub961241:fix/container-backup-mount-skip-12236

Conversation

@jakub961241
Copy link

Summary

Fixes #12236 - Container backup fails and gets stuck in "running" state when a mounted directory is too large or disk runs out of space.

Root Cause

In stepBackupContainerMounts(), when CopyDirWithNewName or CopyFile fails for any mount, the function returns the error immediately, causing the entire backup task to fail. With large bind mounts, this is common (disk full, permissions, etc.).

Fix

Mount copy failures are now non-fatal:

  • Error is logged via global.LOG.Errorf
  • Mount metadata records status: "failed" with the error message
  • Backup continues with remaining mounts
  • Task completes successfully with partial backup data

Before:

if err := backupCtx.fileOp.CopyDirWithNewName(...); err != nil {
    return err  // entire backup fails
}

After:

if err := backupCtx.fileOp.CopyDirWithNewName(...); err != nil {
    mountMeta.Status = "failed"
    mountMeta.Message = fmt.Sprintf("copy dir failed: %v", err)
    // ... log and continue
    continue
}

Changed file

  • agent/app/service/backup_container.go (+10, -2)
fix: Container backup no longer fails entirely when a mounted directory copy fails (#12236)

…Panel-dev#12236)

When backing up a container with large mounted directories, if the copy
fails (e.g., insufficient disk space), the entire backup task would
fail and get stuck in "running" state in the task center.

Now mount copy failures are logged and recorded with status "failed" in
the backup metadata, but the backup continues with remaining mounts
and completes successfully with partial data. This prevents the task
from hanging indefinitely.

Fixes 1Panel-dev#12236
@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Mar 22, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign zhengkunwang223 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Container backup function is abnormal

1 participant