You are looking at the documentation of a prior release. To read the documentation of the latest release, please visit here.

Troubleshooting "failed to read all source data" issue

Sometimes, the backup fails due to Stash being unable to read the targeted data. In this guide, we are going to explain the possible scenario when this error can happen and what you can do to solve the issue.

Identifying the issue

If you describe the respective BackupSession or view the log from the respective backup sidecar/job, you should see the following error:

Warning: failed to read all source data during backup

Possible reason

By default, Stash runs backup as a non-root user. If the target data directory is not readable to all users, then Stash will fail to read the targeted data.

Solution

Run the backup process as the same user as the targeted application or run the backup process as the root user.

Here is an example of BackupConfiguration for running backup as the root user:

apiVersion: stash.appscode.com/v1beta1
kind: BackupConfiguration
metadata:
  name: sample-statefulset-backup
  namespace: demo
spec:
  repository:
    name: s3-repo
  schedule: "*/3 * * * *"
  target:
    ref:
      apiVersion: apps/v1
      kind: StatefulSet
      name: stash-demo
    volumeMounts:
    - name: data-volume
      mountPath: /my/data
    paths:
    - /my/data
  runtimeSettings:
    container:
      securityContext:
        runAsUser: 0
        runAsGroup: 0
  retentionPolicy:
    name: 'keep-last-5'
    keepLast: 5
    prune: true

If you don’t want to run the backup as root user, then set the runAsUser and runAsGroup to match with your application user and group id.