I'm trying to create an automated backup script using the tar command:

tar -czg /home/user/BackupArchiv/snapshots/snapshot_2020-10-12 -f /home/user/BackupArchiv/backup_2020-10-12/backupfull.tar.gz /home/user

When I try to execute the script, I always get the error messages "file removed before it was read" because of system file and "file changed as we read it" because of the backup file that of course changes during the command. The problem is that these two errors interrupt the script and stop it from continuing. I've already found some solutions where other people added the "--warning" option but my script just ignored that for some reason. How do I get the script to continue after these errors?


You need to exclude the BackupArchiv-Directory.

tar -czg /home/user/BackupArchiv/snapshots/snapshot_2020-10-12 -f /home/user/BackupArchiv/backup_2020-10-12/backupfull.tar.gz /home/user --exclude /home/user/BackupArchiv

  • gtar is not recommended for incremental backups as it fails to extract incrementals for non-trivial changes. The main purpose for backups are restores, so better use tools to backup that have been verified to reliably support restores as well. – schily Oct 12 '20 at 10:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.