offen / docker-volume-backup

Backup Docker volumes locally or to any S3, WebDAV, Azure Blob Storage, Dropbox or SSH compatible storage
https://offen.github.io/docker-volume-backup/
Mozilla Public License 2.0
2.07k stars 86 forks source link

Error write too long #106

Closed thesebastianf closed 2 years ago

thesebastianf commented 2 years ago

Hey this was running fine when I started it. After missing some backups I checked the logs and found:

me="2022-06-08T00:00:34Z" level=info msg="Created backup of `/backup` at `/tmp/homeassistant-2022-06-08T00-00-00.tar.gz`."
time="2022-06-08T00:00:35Z" level=info msg="Stored copy of backup `/tmp/homeassistant-2022-06-08T00-00-00.tar.gz` in local archive `/archive`."
time="2022-06-08T00:00:35Z" level=info msg="None of 4 existing local backup(s) were pruned."
time="2022-06-08T00:00:35Z" level=info msg="Removed tar file `/tmp/homeassistant-2022-06-08T00-00-00.tar.gz`."
time="2022-06-08T00:00:35Z" level=info msg="Finished running backup tasks."
time="2022-06-09T00:00:39Z" level=error msg="Fatal error running backup: takeBackup: error compressing backup folder: createArchive: error creating archive: compress error writing /backup/homeassistant-backup/home-assistant_v2.db to archive: writeTarGz: error copying /backup/homeassistant-backup/home-assistant_v2.db to tar writer: archive/tar: write too long"
time="2022-06-09T00:00:39Z" level=info msg="Removed tar file `/tmp/homeassistant-2022-06-09T00-00-00.tar.gz`."
time="2022-06-10T00:00:47Z" level=info msg="Created backup of `/backup` at `/tmp/homeassistant-2022-06-10T00-00-00.tar.gz`."
time="2022-06-10T00:00:47Z" level=info msg="Stored copy of backup `/tmp/homeassistant-2022-06-10T00-00-00.tar.gz` in local archive `/archive`."
time="2022-06-10T00:00:47Z" level=info msg="None of 5 existing local backup(s) were pruned."
time="2022-06-10T00:00:47Z" level=info msg="Removed tar file `/tmp/homeassistant-2022-06-10T00-00-00.tar.gz`."
time="2022-06-10T00:00:47Z" level=info msg="Finished running backup tasks."
time="2022-06-11T00:00:52Z" level=error msg="Fatal error running backup: takeBackup: error compressing backup folder: createArchive: error creating archive: compress error writing /backup/homeassistant-backup/home-assistant_v2.db to archive: writeTarGz: error copying /backup/homeassistant-backup/home-assistant_v2.db to tar writer: archive/tar: write too long"
time="2022-06-11T00:00:52Z" level=info msg="Removed tar file `/tmp/homeassistant-2022-06-11T00-00-00.tar.gz`."
time="2022-06-12T00:01:18Z" level=error msg="Fatal error running backup: takeBackup: error compressing backup folder: createArchive: error creating archive: compress error writing /backup/homeassistant-backup/home-assistant_v2.db to archive: writeTarGz: error copying /backup/homeassistant-backup/home-assistant_v2.db to tar writer: archive/tar: write too long"
time="2022-06-12T00:01:18Z" level=info msg="Removed tar file `/tmp/homeassistant-2022-06-12T00-00-00.tar.gz`."

what is that write too long telling me?

m90 commented 2 years ago

This could be a duplicate of #21, also see #32. What version are you running?

The error likely means your contents are changing while the archive is being created, so a fix might be copying over contents before creating the archive. See https://github.com/offen/docker-volume-backup#replace-deprecated-backup_from_snapshot-usage

thesebastianf commented 2 years ago

uh thats seems spot on. in this case I would just like to exlude that 1 file for my daily backup on that container

I tried to add a exclude variable to exclude "home-assistant_v2.db"... but obviously dont understand it as it throws an error at docker up environment: BACKUP_FILENAME: homeassistant-%Y-%m-%dT%H-%M-%S.tar.gz BACKUP_PRUNING_PREFIX: homeassistant- BACKUP_RETENTION_DAYS: 60 BACKUP_EXCLUDE_REGEXP: ".db2$"

any hints?

m90 commented 2 years ago

In case the snippet you provided is from a docker-compose.yml you will need to escape the $ using another $, at least that's what works in the tests: https://github.com/offen/docker-volume-backup/blob/8c8a2fa0889a9906a4498b778fdf4902fad74bf0/test/ignore/docker-compose.yml#L12

See: https://docs.docker.com/compose/compose-file/#interpolation