Stop tar from dying just because one file changed mid-backup

Backup & Recovery (Rsync/Tar/Dd)

Stop tar from dying just because one file changed mid-backup

🧩 The Challenge

You are running a full system backup and then suddenly the process exits with a non-zero status because a temp log file got deleted or rotated while tar was reading it. It’s incredibly annoying to have an automated script report a total failure just because of a transient file.

💡 The Fix

Use the ignore-failed-read flag so your backup completes even when files vanish under your feet. It saves you from those midnight alerts that turn out to be nothing.

tar --create --gzip --ignore-failed-read --file=backup.tar.gz /home/user/data

⚙️ Why It Works

Setting this flag tells tar to just issue a warning and keep chugging along instead of treating a missing file as a fatal error. You can then check the return code later if you still want to know if something weird happened.

🚀 Pro-Tip: Always pipe your tar output to a log file if you use this, otherwise you’ll never see which files actually went missing.

Linux Tips & Tricks | © ngelinux.com | 11/22/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted