Stop blowing your backups by trying to copy live files
Backup & Recovery (Rsync/Tar/Dd)
Stop blowing your backups by trying to copy live files
🧩 The Challenge
You ever try to tar up a database or a live web root only to find the files changed mid-stream? I’ve wasted half a day restoring corrupted archives because the files in my backup were in a partially written state.
💡 The Fix
Use the –checkpoint and –checkpoint-action flags with tar to force a sync or just use rsync with the –write-batch option if you need a truly atomic snapshot. It saves you from that sinking feeling when you try to extract a broken backup.
tar --create --file=backup.tar --checkpoint=1000 --checkpoint-action=exec='sync' /path/to/data
⚙️ Why It Works
Setting a checkpoint forces the kernel to flush buffers to disk during the archive process so you aren’t grabbing a mangled mess. It effectively stabilizes the state of the data while the read is in progress.
🚀 Pro-Tip: Pipe your backup through pigz instead of standard gzip if you want to use all your cores and stop waiting an eternity for compression.
Linux Tips & Tricks | © ngelinux.com | 9/12/2026
