Site icon New Generation Enterprise Linux

Stop rsync from choking when a file changes mid-transfer

Backup & Recovery (Rsync/Tar/Dd)

Stop rsync from choking when a file changes mid-transfer

đź§© The Challenge

Backing up live application logs or active database files is a nightmare because rsync freaks out if a file gets modified while it’s reading it. I’ve wasted hours debugging partial backups that turned out to be nothing more than a race condition.

đź’ˇ The Fix

Use the –inplace flag to tell rsync to update the destination file directly instead of creating a temporary hidden file and moving it over. It keeps things stable when the source is constantly changing.

rsync -av --inplace --partial --append-verify /var/log/myapp/ /backup/logs/

⚙️ Why It Works

By writing directly to the target file, you prevent the messy temp-file creation that usually triggers errors or massive disk spikes during active writes.

🚀 Pro-Tip: Add the –append-verify flag to ensure that the bits already copied match the source before it picks up where it left off.

Linux Tips & Tricks | © ngelinux.com | 10/20/2026

0 0 votes
Article Rating
Exit mobile version